Tar-shealladh goirid agus suidheachadh de Kata Containers

Tar-shealladh goirid agus suidheachadh de Kata Containers
Bruidhnidh an artaigil seo mar a tha e ag obair Luchd-gleidhidh Kata, agus bidh pàirt phractaigeach ann cuideachd leis a’ cheangal aca ri Docker.

Mu dhuilgheadasan cumanta le Docker agus na fuasglaidhean aca mu thràth chaidh a sgrìobhadh, an-diugh bheir mi cunntas goirid air buileachadh bho Kata Containers. Tha Kata Containers na ùine ruith tèarainte airson soithichean stèidhichte air innealan brìgheil aotrom. Tha a bhith ag obair còmhla riutha an aon rud ri soithichean eile, ach a bharrachd air an sin tha aonaranachd nas earbsaiche a’ cleachdadh teicneòlas virtualization bathar-cruaidh. Thòisich am pròiseact ann an 2017, nuair a chuir a’ choimhearsnachd den aon ainm crìoch air aonachadh nam beachdan as fheàrr bho Intel Clear Containers agus Hyper.sh RunV, às deidh sin lean obair air taic airson diofar ailtireachd, nam measg AMD64, ARM, IBM p- agus z. -sreath. A bharrachd air an sin, tha obair a’ faighinn taic taobh a-staigh an hypervisors QEMU, Firecracker, agus tha amalachadh le container cuideachd. Tha an còd ri fhaighinn aig GitHub fo chead MIT.

Prìomh fheartan

  • Ag obair le cridhe air leth, mar sin a’ toirt seachad lìonra, cuimhne agus aonaranachd I / O, tha e comasach cleachdadh aonaranachd bathar-cruaidh a sparradh stèidhichte air leudachadh virtualization
  • Taic airson inbhean gnìomhachais a’ toirt a-steach OCI (cruth soithich), Kubernetes CRI
  • Coileanadh cunbhalach de shoithichean Linux cunbhalach, barrachd aonaranachd às aonais coileanadh os cionn VMan cunbhalach
  • Cuir às don fheum air soithichean a ruith taobh a-staigh innealan brìgheil làn-chuimseach, bidh eadar-aghaidh gnèitheach a’ sìmpleachadh amalachadh agus cur air bhog

suidheachadh

tha mòran roghainnean stàlaidh, beachdaichidh mi air stàladh bho na stòran, stèidhichte air siostam-obrachaidh Centos 7.
Cudromach: Tha obair Kata Containers a’ faighinn taic a-mhàin air bathar-cruaidh, chan eil cuir air adhart virtualization an-còmhnaidh ag obair, cuideachd feumach air taic sse4.1 bhon phròiseasar.

Tha stàladh Kata Containers gu math sìmplidh:

Stàlaich goireasan airson a bhith ag obair le stòran:

# yum -y install yum-utils

Cuir à comas Selinux (tha e nas ceart a rèiteachadh, ach airson sìmplidheachd tha mi ga dhì-cheadachadh):

# setenforce 0
# sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

Bidh sinn a 'ceangal an stòr agus a' dèanamh an stàladh

# source /etc/os-release
# ARCH=$(arch)
# BRANCH="${BRANCH:-stable-1.10}"
# yum-config-manager --add-repo "http://download.opensuse.org/repositories/home:/katacontainers:/releases:/${ARCH}:/${BRANCH}/CentOS_${VERSION_ID}/home:katacontainers:releases:${ARCH}:${BRANCH}.repo"
# yum -y install kata-runtime kata-proxy kata-shim

adjustment

Bidh mi a’ stèidheachadh a bhith ag obair le docker, tha an stàladh aige àbhaisteach, cha toir mi cunntas nas mionaidiche air:

# rpm -qa | grep docker
docker-ce-cli-19.03.6-3.el7.x86_64
docker-ce-19.03.6-3.el7.x86_64
# docker -v
Docker version 19.03.6, build 369ce74a3c

Bidh sinn a’ dèanamh atharrachaidhean air daemon.json:

# cat <<EOF > /etc/docker/daemon.json
{
  "default-runtime": "kata-runtime",
  "runtimes": {
    "kata-runtime": {
      "path": "/usr/bin/kata-runtime"
    }
  }
}
EOF

Ath-thòiseachadh docker:

# service docker restart

Sgrùdadh Slàinte

Ma thòisicheas tu an soitheach mus tòisich thu air docker ath-thòiseachadh, chì thu gun toir uname an dreach den kernel a tha a’ ruith air a’ phrìomh shiostam:

# docker run busybox uname -a
Linux 19efd7188d06 3.10.0-1062.12.1.el7.x86_64 #1 SMP Tue Feb 4 23:02:59 UTC 2020 x86_64 GNU/Linux

Às deidh ath-thòiseachadh, tha coltas mar seo air an dreach kernel:

# docker run busybox uname -a
Linux 9dd1f30fe9d4 4.19.86-5.container #1 SMP Sat Feb 22 01:53:14 UTC 2020 x86_64 GNU/Linux

Barrachd sgiobaidhean!

# time docker run busybox mount
kataShared on / type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,name=systemd)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
kataShared on /etc/resolv.conf type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio)
kataShared on /etc/hostname type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio)
kataShared on /etc/hosts type 9p (rw,dirsync,nodev,relatime,mmap,access=client,trans=virtio)
proc on /proc/bus type proc (ro,relatime)
proc on /proc/fs type proc (ro,relatime)
proc on /proc/irq type proc (ro,relatime)
proc on /proc/sys type proc (ro,relatime)
tmpfs on /proc/acpi type tmpfs (ro,relatime)
tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /sys/firmware type tmpfs (ro,relatime)

real    0m2.381s
user    0m0.066s
sys 0m0.039s

# time docker run busybox free -m
              total        used        free      shared  buff/cache   available
Mem:           1993          30        1962           0           1        1946
Swap:             0           0           0

real    0m3.297s
user    0m0.086s
sys 0m0.050s

Deuchainn luchdan luath

Gus measadh a dhèanamh air call bho virtualization - bidh mi a 'ruith sysbench, mar na prìomh eisimpleirean gabh an roghainn seo.

A’ ruith sysbench a’ cleachdadh Docker + container

Pròiseasaran deuchainn

sysbench 1.0:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

General statistics:
    total time:                          36.7335s
    total number of events:              10000
    total time taken by event execution: 36.7173s
    response time:
         min:                                  3.43ms
         avg:                                  3.67ms
         max:                                  8.34ms
         approx.  95 percentile:               3.79ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   36.7173/0.00

RAM deuchainn

sysbench 1.0:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Initializing worker threads...

Threads started!

Operations performed: 104857600 (2172673.64 ops/sec)

102400.00 MiB transferred (2121.75 MiB/sec)

General statistics:
    total time:                          48.2620s
    total number of events:              104857600
    total time taken by event execution: 17.4161s
    response time:
         min:                                  0.00ms
         avg:                                  0.00ms
         max:                                  0.17ms
         approx.  95 percentile:               0.00ms

Threads fairness:
    events (avg/stddev):           104857600.0000/0.00
    execution time (avg/stddev):   17.4161/0.00

A’ ruith sysbench a’ cleachdadh Docker + Kata Containers

Pròiseasaran deuchainn

sysbench 1.0:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

General statistics:
    total time:                          36.5747s
    total number of events:              10000
    total time taken by event execution: 36.5594s
    response time:
         min:                                  3.43ms
         avg:                                  3.66ms
         max:                                  4.93ms
         approx.  95 percentile:               3.77ms

Threads fairness:
    events (avg/stddev):           10000.0000/0.00
    execution time (avg/stddev):   36.5594/0.00

RAM deuchainn

sysbench 1.0:  multi-threaded system evaluation benchmark

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time

Initializing worker threads...

Threads started!

Operations performed: 104857600 (2450366.94 ops/sec)

102400.00 MiB transferred (2392.94 MiB/sec)

General statistics:
    total time:                          42.7926s
    total number of events:              104857600
    total time taken by event execution: 16.1512s
    response time:
         min:                                  0.00ms
         avg:                                  0.00ms
         max:                                  0.43ms
         approx.  95 percentile:               0.00ms

Threads fairness:
    events (avg/stddev):           104857600.0000/0.00
    execution time (avg/stddev):   16.1512/0.00

Ann am prionnsabal, tha an suidheachadh mar-thà soilleir, ach tha e nas fheàrr na deuchainnean a ruith grunn thursan, a 'toirt air falbh na h-àiteachan a-muigh agus cuibheasachd nan toraidhean, agus mar sin cha bhith mi a' dèanamh barrachd dheuchainnean fhathast.

toraidhean

A dh 'aindeoin gu bheil na soithichean sin a' toirt timcheall air còig gu deich tursan nas fhaide airson tòiseachadh (tha an ùine ruith àbhaisteach airson òrdughan coltach ris nuair a bhios tu a 'cleachdadh soitheach nas lugha na trian de dhiog), bidh iad fhathast ag obair gu math luath ma ghabhas sinn an ùine tòiseachaidh iomlan (an sin nan eisimpleirean gu h-àrd, òrdughan air an coileanadh ann an cuibheasachd de thrì diogan). Uill, tha toraidhean deuchainn sgiobalta de CPU agus RAM a’ nochdadh cha mhòr na h-aon toraidhean, nach urrainn ach gàirdeachas a dhèanamh, gu sònraichte leis gu bheil aonaranachd air a thoirt seachad le bhith a’ cleachdadh uidheamachd cho math ri kvm.

Sanas

Is e lèirmheas a th’ anns an artaigil, ach bheir e cothrom dhut a bhith a’ faireachdainn an ùine ruith eile. Chan eil mòran raointean tagraidh air an còmhdach, mar eisimpleir, tha an làrach ag innse mu chomas Kubernetes a ruith air mullach Kata Containers. A bharrachd air an sin, faodaidh tu cuideachd sreath de dheuchainnean a ruith le fòcas air duilgheadasan tèarainteachd a lorg, cuingealachaidhean a shuidheachadh, agus rudan inntinneach eile.

Bidh mi ag iarraidh air a h-uile duine a tha air leughadh agus ath-chuairt an seo pàirt a ghabhail san sgrùdadh, air am bi foillseachaidhean san àm ri teachd air a’ chuspair seo an urra.

Chan fhaod ach luchd-cleachdaidh clàraichte pàirt a ghabhail san sgrùdadh. Soidhnig a-steach, mas e do thoil e.

Am bu chòir dhomh cumail a’ foillseachadh artaigilean mu Kata Containers?

  • 80,0%Seadh, sgrìobh tuilleadh!28

  • 20,0%Chan e, na dèan…7

Bhòt 35 neach-cleachdaidh. Sheall 7 neach-cleachdaidh.

Source: www.habr.com

Cuir beachd ann