©2020 VMware, Inc.
CRX:
Container Runtime
Executive
ESXi上で動くコンテナの仕組み
22nd August 2020
ヴイエムウェア株式会社
村田 一平
©2020 VMware, Inc.
Agenda
2
Table of Contents
• VMwareがコンテナを扱うワケ
• CRXとは
• CRX Architecture詳細 全体像
• CRX Architecture詳細 コンテナ起動時のシーケンス
• 性能
• ユースケース
©2020 VMware, Inc. 3
VMwareがコンテナを扱うワケ
VMwareとは:
• 仮想化市場で有名な会社
• サーバ仮想化(vSphere)、ストレージ仮想化(vSAN)、
ネットワーク仮想化(NSX)、デスクトップ仮想化(Horizon), etc
なぜ仮想屋がコンテナランタイム?
• 仮想マシン(VM)とコンテナの一元管理
• リソースの最適化(集約・高速) ハイパバイザ
(ESXi)
VM
Container
同じ扱い
©2020 VMware, Inc. 4
VMwareがコンテナを扱うワケ
VMwareとは:
• 仮想化市場で有名な会社
• サーバ仮想化(vSphere)、ストレージ仮想化(vSAN)、
ネットワーク仮想化(NSX)、デスクトップ仮想化(Horizon), etc
なぜ仮想屋がコンテナランタイム?
• 仮想マシン(VM)とコンテナの一元管理
• リソースの最適化(集約・高速)
コンテナランタイム:CRX
ハイパバイザ
(ESXi)
VM
Container
同じ扱い
©2020 VMware, Inc. 5
CRXとは
CRX: Container Runtime Executive
(旧:Container Runtime for ESXi)
= ESXi上で動くコンテナランタイム
= コンテナ起動のための最小限の仮想マシン
= Linux Kernel + 最小限のコンポーネント
ESXi
VM
Ubuntu
Docker
VM
OS
(Photon)
vSphere
Agent
一般的な
スタック
CRX
©2020 VMware, Inc. 6
CRX Architecture詳細 全体像
ESXi
VM
OS
Spherelet
API
Master
Master Node
k8s
Sched
Image
Service
Hostd
Sched
ExtensionvCenter
Kubectl
CRX
CRX-tool
libcontainer
CRX-init
initrd
kernel
Spherelet
Agent
©2020 VMware, Inc. 7
CRX Architecture詳細 コンテナ起動時のシーケンス
API
Master
Scheduler
Extension
DRS vCenterkubectl
kubectl create
Hostd
Spherelet
Agent
Spherelet
Request Pod
location
Decide location
Request VM
creation
Create CRX(VM)
CRX Power on
VM UUID
Node, VM UUID
Add UUID to
annotation
Node, Pod spec
Request Pod creation Reconfigure CRX
Request Pod creation
kernel init
CRX
Boot init process
Initialize OS
Boot
Spherelet Agent
Pod status
vSphere
k8s Master
Request Pod
creation
Initialize network, etc
Assign VMDK, vNIC
Boot Container, etc
©2020 VMware, Inc. 8
高速起動のコツ(1) − ブートプロセス
API
Master
Scheduler
Extension
DRS vCenterkubectl
kubectl create
Hostd
Spherelet
Agent
Spherelet
Request Pod
location
Decide location
Request VM
creation
Create CRX(VM)
CRX Power on
VM UUID
Node, VM UUID
Add UUID to
annotation
Node, Pod spec
Request Pod creation Reconfigure CRX
Request Pod creation
kernel init
CRX
Boot init process
Initialize OS
Boot
Spherelet Agent
Pod status
vSphere
k8s Master
Request Pod
creation
Initialize network, etc
Assign VMDK, vNIC
Boot Container, etc
©2020 VMware, Inc. 9
高速起動のコツ(1) − ブートプロセス
API
Master
Scheduler
Extension
DRS vCenterkubectl
kubectl create
Hostd
Spherelet
Agent
Spherelet
Request Pod
location
Decide location
Request VM
creation
Create CRX(VM)
CRX Power on
VM UUID
Node, VM UUID
Add UUID to
annotation
Node, Pod spec
Request Pod creation Reconfigure CRX
Request Pod creation
kernel init
CRX
Boot init process
Initialize OS
Boot
Spherelet Agent
Pod status
vSphere
k8s Master
Request Pod
creation
Initialize network, etc
Assign VMDK, vNIC
Boot Container, etc
ブートプロセス
1. BIOS(UEFI)のブート
2. ブートローダによるカーネルのロード
3. カーネルの起動
カーネルの自己展開
組み込みドライバのロード
initrdの展開
4. initプロセスの起動
©2020 VMware, Inc. 10
高速起動のコツ(1) − ブートプロセス
API
Master
Scheduler
Extension
DRS vCenterkubectl
kubectl create
Hostd
Spherelet
Agent
Spherelet
Request Pod
location
Decide location
Request VM
creation
Create CRX(VM)
CRX Power on
VM UUID
Node, VM UUID
Add UUID to
annotation
Node, Pod spec
Request Pod creation Reconfigure CRX
Request Pod creation
kernel init
CRX
Boot init process
Initialize OS
Boot
Spherelet Agent
Pod status
vSphere
k8s Master
Request Pod
creation
Initialize network, etc
Assign VMDK, vNIC
Boot Container, etc
ブートプロセス
1. BIOS(UEFI)のブート
2. ブートローダによるカーネルのロード
3. カーネルの起動
カーネルの自己展開
組み込みドライバのロード
initrdの展開
4. initプロセスの起動
©2020 VMware, Inc. 11
高速起動のコツ(2)− 共有
initrd
Container
vmlinux
Container Container Container
・vmlinux, initrdはメモリ上でファイル共有
→キャッシュミス、PageFault削減
・initrdのメモリアライン最適化
(cpio改造によるアラインメント)
initrd
vmlinux
initrd
vmlinux
initrd
vmlinux
initrd
vmlinux
VisorFS
(tmpfsみたいなもの)
©2020 VMware, Inc. 12
性能
©2020 VMware, Inc. 13
性能
VM Creation: 200 ~ 300 ms
VM Power On: 300 ~ 400 ms
spherelet client/agent: 100 ~ 200 ms
0
1000
2000
3000
4000
5000
起動時間(ms)
Podの起動時間(Pauseコンテナ)
注意点:
K8sクラスタ上でのPodの起動時間 < CRXでPodを起動する時間
©2020 VMware, Inc. 14
ユースケース
• CRX単体でのユースケース
• as a Serviceの提供
• セキュリティ要件が厳しい場合
• 仮想マシンとCRXを使ったコンテナを組み合わせた場合のユースケース
• VMとPodで同じように管理・監視したい場合
• 柔軟にリソースを活用して運用したい場合
→ 例えば、DR用リソースをVMにもPodにも利用可能
©2020 VMware, Inc.
Thank You

CRX: Container Runtime Executive 

  • 1.
    ©2020 VMware, Inc. CRX: ContainerRuntime Executive ESXi上で動くコンテナの仕組み 22nd August 2020 ヴイエムウェア株式会社 村田 一平
  • 2.
    ©2020 VMware, Inc. Agenda 2 Tableof Contents • VMwareがコンテナを扱うワケ • CRXとは • CRX Architecture詳細 全体像 • CRX Architecture詳細 コンテナ起動時のシーケンス • 性能 • ユースケース
  • 3.
    ©2020 VMware, Inc.3 VMwareがコンテナを扱うワケ VMwareとは: • 仮想化市場で有名な会社 • サーバ仮想化(vSphere)、ストレージ仮想化(vSAN)、 ネットワーク仮想化(NSX)、デスクトップ仮想化(Horizon), etc なぜ仮想屋がコンテナランタイム? • 仮想マシン(VM)とコンテナの一元管理 • リソースの最適化(集約・高速) ハイパバイザ (ESXi) VM Container 同じ扱い
  • 4.
    ©2020 VMware, Inc.4 VMwareがコンテナを扱うワケ VMwareとは: • 仮想化市場で有名な会社 • サーバ仮想化(vSphere)、ストレージ仮想化(vSAN)、 ネットワーク仮想化(NSX)、デスクトップ仮想化(Horizon), etc なぜ仮想屋がコンテナランタイム? • 仮想マシン(VM)とコンテナの一元管理 • リソースの最適化(集約・高速) コンテナランタイム:CRX ハイパバイザ (ESXi) VM Container 同じ扱い
  • 5.
    ©2020 VMware, Inc.5 CRXとは CRX: Container Runtime Executive (旧:Container Runtime for ESXi) = ESXi上で動くコンテナランタイム = コンテナ起動のための最小限の仮想マシン = Linux Kernel + 最小限のコンポーネント ESXi VM Ubuntu Docker VM OS (Photon) vSphere Agent 一般的な スタック CRX
  • 6.
    ©2020 VMware, Inc.6 CRX Architecture詳細 全体像 ESXi VM OS Spherelet API Master Master Node k8s Sched Image Service Hostd Sched ExtensionvCenter Kubectl CRX CRX-tool libcontainer CRX-init initrd kernel Spherelet Agent
  • 7.
    ©2020 VMware, Inc.7 CRX Architecture詳細 コンテナ起動時のシーケンス API Master Scheduler Extension DRS vCenterkubectl kubectl create Hostd Spherelet Agent Spherelet Request Pod location Decide location Request VM creation Create CRX(VM) CRX Power on VM UUID Node, VM UUID Add UUID to annotation Node, Pod spec Request Pod creation Reconfigure CRX Request Pod creation kernel init CRX Boot init process Initialize OS Boot Spherelet Agent Pod status vSphere k8s Master Request Pod creation Initialize network, etc Assign VMDK, vNIC Boot Container, etc
  • 8.
    ©2020 VMware, Inc.8 高速起動のコツ(1) − ブートプロセス API Master Scheduler Extension DRS vCenterkubectl kubectl create Hostd Spherelet Agent Spherelet Request Pod location Decide location Request VM creation Create CRX(VM) CRX Power on VM UUID Node, VM UUID Add UUID to annotation Node, Pod spec Request Pod creation Reconfigure CRX Request Pod creation kernel init CRX Boot init process Initialize OS Boot Spherelet Agent Pod status vSphere k8s Master Request Pod creation Initialize network, etc Assign VMDK, vNIC Boot Container, etc
  • 9.
    ©2020 VMware, Inc.9 高速起動のコツ(1) − ブートプロセス API Master Scheduler Extension DRS vCenterkubectl kubectl create Hostd Spherelet Agent Spherelet Request Pod location Decide location Request VM creation Create CRX(VM) CRX Power on VM UUID Node, VM UUID Add UUID to annotation Node, Pod spec Request Pod creation Reconfigure CRX Request Pod creation kernel init CRX Boot init process Initialize OS Boot Spherelet Agent Pod status vSphere k8s Master Request Pod creation Initialize network, etc Assign VMDK, vNIC Boot Container, etc ブートプロセス 1. BIOS(UEFI)のブート 2. ブートローダによるカーネルのロード 3. カーネルの起動 カーネルの自己展開 組み込みドライバのロード initrdの展開 4. initプロセスの起動
  • 10.
    ©2020 VMware, Inc.10 高速起動のコツ(1) − ブートプロセス API Master Scheduler Extension DRS vCenterkubectl kubectl create Hostd Spherelet Agent Spherelet Request Pod location Decide location Request VM creation Create CRX(VM) CRX Power on VM UUID Node, VM UUID Add UUID to annotation Node, Pod spec Request Pod creation Reconfigure CRX Request Pod creation kernel init CRX Boot init process Initialize OS Boot Spherelet Agent Pod status vSphere k8s Master Request Pod creation Initialize network, etc Assign VMDK, vNIC Boot Container, etc ブートプロセス 1. BIOS(UEFI)のブート 2. ブートローダによるカーネルのロード 3. カーネルの起動 カーネルの自己展開 組み込みドライバのロード initrdの展開 4. initプロセスの起動
  • 11.
    ©2020 VMware, Inc.11 高速起動のコツ(2)− 共有 initrd Container vmlinux Container Container Container ・vmlinux, initrdはメモリ上でファイル共有 →キャッシュミス、PageFault削減 ・initrdのメモリアライン最適化 (cpio改造によるアラインメント) initrd vmlinux initrd vmlinux initrd vmlinux initrd vmlinux VisorFS (tmpfsみたいなもの)
  • 12.
  • 13.
    ©2020 VMware, Inc.13 性能 VM Creation: 200 ~ 300 ms VM Power On: 300 ~ 400 ms spherelet client/agent: 100 ~ 200 ms 0 1000 2000 3000 4000 5000 起動時間(ms) Podの起動時間(Pauseコンテナ) 注意点: K8sクラスタ上でのPodの起動時間 < CRXでPodを起動する時間
  • 14.
    ©2020 VMware, Inc.14 ユースケース • CRX単体でのユースケース • as a Serviceの提供 • セキュリティ要件が厳しい場合 • 仮想マシンとCRXを使ったコンテナを組み合わせた場合のユースケース • VMとPodで同じように管理・監視したい場合 • 柔軟にリソースを活用して運用したい場合 → 例えば、DR用リソースをVMにもPodにも利用可能
  • 15.