SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
krustlet 101
Shiho ASA
Agenda
• Kubernetes とは
• WebAssembly とは
• Krustlet とは
• Demo
• まとめ
Kubernetes とは
 コンテナベースのアプリを分散環境で動作するためのプラットフォーム
ここ最近プロダクション環境での利用が増え、セキュリティやコストに注目
コンテナアプリの特徴
• ポータブル
• 軽量
Kubernetes の特徴
• 宣言的設定
• 自己修復
Kubernetes のしくみ
 Control PlaneがClusterをdesired state (望ましい状態)に維持するよう動作
 kubeletのPod Lifecycle Event Generator(PLEG)モジュールは、Containerの状態を
調整し、最新の状態に保つ
api-server
controller
-manager
kubelet
scheduler
etcd
master node
Kubernetes cluster
High-Level
Container Runtime
Low-Level
.yaml
Containers
WebAssembly(WASM)とは
 ブラウザにダウンロードして実行できるバイナリ
 Firefox/Chrome/Safari/Edgeなどの主要なブラウザに対応
 Google/Microsoft/Mozilla/Appleなどが共同で仕様策定
 C/C++/Rust/Golang/TypeScriptなどからLLVMベースの
コンパイラーでコンパイル可能
WASMの目指すところ
• ポータブル
• 軽量・高速
• 安全
Compile Once, Run Anywhere
引用: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
• POSIX の場合
異なるバージョンのlibcでコンパイルし
異なるマシンをターゲットにする
• WebAssembly の場合
ポータブルなバイナリを提供
Security
引用: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
POSIX の場合
• ユーザーがプログラムを起動
• ユーザーがファイルにアクセスでき
る場合 プログラムも同じアクセス
権を持つ
WebAssembly の場合
• サンドボックス化されコードはOSに
直接通信不可
• プログラムごとに実行制限できる
WASI (WebAssembly System Interface) とは
 WebAssembly をブラウザ以外の環境で実行できるよう
ホストのファイルやネットワークなどの資源に安全にアクセスする
ための仕様
 Fastly/Mozilla/Node.jsなどが共同でWASIの策定を開始
 POSIXに似たAPIが定義されている
 最初から必要なAPIをすべて策定するのではなくモジュール形式で
順次拡張していく方針
https://wasi.dev/
あ、、れ!?
Kubernetes meets WebAssembly
api-server
controller
-manager
scheduler
etcd
master node
Kubernetes cluster
WASM Runtime
.yaml
WASM
modules
Kubernetesの世界
Krustlet
WebAssemblyの世界
• WASMのバイナリフォーマットは
そのまま実行できない
• WASM Runtimeがネイティブコード
に変換して実行
✓ ポータブル
✓ 軽量・高速
✓ 安全
Krustlet とは
• Rustによるkubeletの実装
「Kubernetes-rust-kubelet」を略したもの
• Kubernetes NodeでWASM Mosuleを実行・管理
Kubernetesインターフェイスを使用
◼ セキュリティ
アクセス明示的なアクセ
ス許可なしで、OSに直接
できない
◼ 軽量・高速
Containerより軽量
Nodeごとに実行できる
Moduleの数が多くなる
◼ ポータブル
任意のOSで WASM Module
をコンパイルし任意の
Nodeで実行
Krustlet のしくみ
• Krustletは、KubernetesのNodeとして
Kubernetes Clusterに登録
• Krustletで使用できるランタイムは
現時点ではwasccまたはwasi
• Kubeletと同じくPodの生成・削除・更新
を行う
• Krustlet Nodeは、Taint/ Toleration
nodeSelectorを使用
• Kubernetesのapi-serverと通信して
新たなPod requestを待機し、WASM
ModuleをNodeで実行
apiVersion: v1
kind: Pod
metadata:
name: hello-world-wasi-rust
spec:
containers:
- name: hello-world-wasi-rust
image: xxx.azurecr.io/hello-world-wasi-rust:v1
nodeSelector:
kubernetes.io/arch: "wasm32-wasi"
tolerations:
- key: "krustlet/arch"
operator: "Equal"
value: "wasm32-wasi"
effect: "NoExecute"
- key: "node.kubernetes.io/network-unavailable"
operator: "Exists"
effect: "NoSchedule"
対応するProvider
 WASI
• WASIに準拠した`wastime`を使用
• ネットワーク機能が現時点で利用できない
 waSCC
• WebAssembly Secure Capabilities Connector
• Actor Modelを採用
• ネットワーク機能をサポート
• クラウドネイティブサービス(メッセージブローカー/データベース)
連携やIoT/組み込みハードウェアなどでの利用
• 強固なセキュリティモデル・JSON Web Tokenで署名が必要
https://wascc.dev/
WASM Module の管理 wasm-to-oci
 clang(c)/cargo(Rust)などを使用してWASM moduleをBuild
 OSSのwasm-to-ociを使用し、WebAssembly moduleをPush
 OCI ArtifactsをサポートしたレジストリにBlobとして格納
$ wasm-to-oci push hello.wasm <oci-registry>.azurecr.io/hello:v1
https://github.com/engineerd/wasm-to-oci
• Google Container Registry
• Harbor Container Registry v2.0
• Distribution
• Azure Container Registry
Demo 環境
api-server
controller
-manager
scheduler
etcd
master
node #1
Azure Kubernetes Service
.yaml
wassc
WASM modules
Krustlet
WaSCC
Docker
Container
Kubelet
node #2
OCI Registry
Demo: Krustlet の環境構築
Demo: WebAssembly ModuleのBuild & Ship
Demo: WebAssembly Moduleの Run
Dockerの
Solomon Hykes氏
もしもWebAssemblyと
WASIが2008年に存在し
ていたら
Dockerを開発する
必要はなかった
Linux Containerとの違い
Linux Containerと WebAssembly を比較すること=両方の技術にとって不公平
開発者は、2つの長所と短所を使い分けるとハッピー!
WebAssembly
• ハードウェアに関係なくどこでも実行で
きるポータブルバイナリ形式を提供
• OS レベルのSandbox環境と同じ柔軟性は
提供されない
Linux Container
• OS レベルのSandbox環境を提供す
るように設計
• インテル・チップセット用にコン
パイルされたコードは ARM ハード
ウェア上で実行できない
https://deislabs.io/posts/introducing-krustlet/
まとめ
• Krustlet とはKubernetes Cluster上でWebAssemblyを動かす
ためのRust製Kubelet
• WebAssemblyの特徴であるポータブル・軽量・安全なアプリ
ケーションとKubertetesの宣言ベースでの実行環境を組み合
わせるというおもしろアプローチ
• WebAssembly ModuleはOCI Registryにて管理可能
• 既存のコンテナエコシステムとうまく共存させるのが良い
参考文献
• Krustlet(GitHub)
https://github.com/deislabs/krustlet
• Introducing Krustlet, the WebAssembly Kubelet
https://deislabs.io/posts/introducing-krustlet/
• WebAssembly meets Kubernetes with Krustlet
https://cloudblogs.microsoft.com/opensource/2020/04/07/announcing-krustlet-kubernetes-rust-kubelet-webassembly-wasm/
• WebAssembly on Kubernetes!(Matt Fisher)
https://www.youtube.com/watch?v=epdUIS5FDyQ
• Getting Started With Krustlet
https://www.youtube.com/watch?v=9U_ldSwQNJU
• WebAssembly, Krustlet, and the Future
https://www.youtube.com/watch?v=sygr4qZ-X8g
• WASI
https://wasi.dev/
• Pod Lifecycle Event Generator: Understanding the “PLEG is not healthy” issue in Kubernetes
https://developers.redhat.com/blog/2019/11/13/pod-lifecycle-event-generator-understanding-the-pleg-is-not-healthy-issue-in-kubernetes/
• Standardizing WASI: A system interface to run WebAssembly outside the web
https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
• Kevin Hoffman — Building a Containerless Future with WebAssembly
https://www.youtube.com/watch?v=vqBtoPJoQOE
• Distributing WebAssembly modules using OCI registries
https://radu-matei.com/blog/wasm-to-oci/
thanks
https://aka.ms/krustlet101
セッションアンケートにご協力お願いします

Mais conteúdo relacionado

Mais procurados

Legacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみた
Legacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみたLegacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみた
Legacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみた
Daiki Kawanuma
 

Mais procurados (20)

Java-minishift-20191123
Java-minishift-20191123Java-minishift-20191123
Java-minishift-20191123
 
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with PythonPythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
PythonによるAzureサーバレスアプリケーション開発 / Serverless Application Development with Python
 
Introduction to Azure Service Fabric
Introduction to Azure Service FabricIntroduction to Azure Service Fabric
Introduction to Azure Service Fabric
 
[Microsoft Tech Summit] Linux/Java にも対応! Azure Service Fabric を使ったマイクロサービス開発
[Microsoft Tech Summit] Linux/Java にも対応! Azure Service Fabric を使ったマイクロサービス開発[Microsoft Tech Summit] Linux/Java にも対応! Azure Service Fabric を使ったマイクロサービス開発
[Microsoft Tech Summit] Linux/Java にも対応! Azure Service Fabric を使ったマイクロサービス開発
 
20220302_TechDojo_OpenShift_BootCamp_1章概要
20220302_TechDojo_OpenShift_BootCamp_1章概要20220302_TechDojo_OpenShift_BootCamp_1章概要
20220302_TechDojo_OpenShift_BootCamp_1章概要
 
Azure Cloud Application Design and Implementation Guidance の紹介
Azure Cloud Application Design and Implementation Guidance の紹介Azure Cloud Application Design and Implementation Guidance の紹介
Azure Cloud Application Design and Implementation Guidance の紹介
 
最近Preview公開されたAzure テストサービスを試してみた
最近Preview公開されたAzure テストサービスを試してみた最近Preview公開されたAzure テストサービスを試してみた
最近Preview公開されたAzure テストサービスを試してみた
 
Azure App Service Overview
Azure App Service OverviewAzure App Service Overview
Azure App Service Overview
 
Servcie Fabric and Cloud Design Pattern
Servcie Fabric and Cloud Design PatternServcie Fabric and Cloud Design Pattern
Servcie Fabric and Cloud Design Pattern
 
コマンド1発でAzureにDC/OS環境を作る方法
コマンド1発でAzureにDC/OS環境を作る方法コマンド1発でAzureにDC/OS環境を作る方法
コマンド1発でAzureにDC/OS環境を作る方法
 
[AC07] 米国マイクロソフト本社で体験したノウハウを伝授!マイクロサービス実行基盤Azure Service Fabricの勘所
[AC07] 米国マイクロソフト本社で体験したノウハウを伝授!マイクロサービス実行基盤Azure Service Fabricの勘所[AC07] 米国マイクロソフト本社で体験したノウハウを伝授!マイクロサービス実行基盤Azure Service Fabricの勘所
[AC07] 米国マイクロソフト本社で体験したノウハウを伝授!マイクロサービス実行基盤Azure Service Fabricの勘所
 
20190201 Cloud Native Kansai AKS Azure
20190201 Cloud Native Kansai AKS Azure20190201 Cloud Native Kansai AKS Azure
20190201 Cloud Native Kansai AKS Azure
 
Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!
Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!
Web App for Containers + Cosmos DBで コンテナ対応したMEANアプリを作ろう!
 
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -
Azure Functions&Logic Appではじめるサーバレスアプリケーション開発 - 応用編 -
 
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
 
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
コンテナ&サーバーレス:トレンドの考察と少し先の未来の展望
 
Legacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみた
Legacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみたLegacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみた
Legacy App Operator というパワーワードで Cloud Native 時代を乗り越えられないか考えてみた
 
Azure PaaSを活用したモダン E コマースソリューションの構築方法
Azure PaaSを活用したモダン E コマースソリューションの構築方法Azure PaaSを活用したモダン E コマースソリューションの構築方法
Azure PaaSを活用したモダン E コマースソリューションの構築方法
 
What's Azure DevOps
What's Azure DevOpsWhat's Azure DevOps
What's Azure DevOps
 
20140605_じどうかの窓口_CloudBees_Jenkins
20140605_じどうかの窓口_CloudBees_Jenkins20140605_じどうかの窓口_CloudBees_Jenkins
20140605_じどうかの窓口_CloudBees_Jenkins
 

Semelhante a Krustlet101

Semelhante a Krustlet101 (20)

Azure container as a service v0.1.19.1213
Azure container as a service v0.1.19.1213Azure container as a service v0.1.19.1213
Azure container as a service v0.1.19.1213
 
これから始めるAzure Kubernetes Service入門
これから始めるAzure Kubernetes Service入門これから始めるAzure Kubernetes Service入門
これから始めるAzure Kubernetes Service入門
 
Kubernete超概要
Kubernete超概要Kubernete超概要
Kubernete超概要
 
k3s のすすめ
k3s のすすめk3s のすすめ
k3s のすすめ
 
6 月 18 日 Next - Kubernetes のコンテナ技術ですべてをシンプルに
6 月 18 日 Next - Kubernetes のコンテナ技術ですべてをシンプルに6 月 18 日 Next - Kubernetes のコンテナ技術ですべてをシンプルに
6 月 18 日 Next - Kubernetes のコンテナ技術ですべてをシンプルに
 
Azure Kubernetes Service Overview
Azure Kubernetes Service OverviewAzure Kubernetes Service Overview
Azure Kubernetes Service Overview
 
Verrazzanoご紹介
Verrazzanoご紹介Verrazzanoご紹介
Verrazzanoご紹介
 
Kubernetes Operator for vSphere VM
Kubernetes Operator for vSphere VMKubernetes Operator for vSphere VM
Kubernetes Operator for vSphere VM
 
Infra: Kubernetes and GKE, Network
Infra: Kubernetes and GKE, NetworkInfra: Kubernetes and GKE, Network
Infra: Kubernetes and GKE, Network
 
20170413 aws–windows users meetup
20170413 aws–windows users meetup20170413 aws–windows users meetup
20170413 aws–windows users meetup
 
【ことはじめ】 はじめてのコンテナ活用をクラウドで
【ことはじめ】 はじめてのコンテナ活用をクラウドで【ことはじめ】 はじめてのコンテナ活用をクラウドで
【ことはじめ】 はじめてのコンテナ活用をクラウドで
 
Kubernetes Meetup Tokyo #8 Self-hosted Kubernetes を調べてみた
Kubernetes Meetup Tokyo #8 Self-hosted Kubernetes を調べてみたKubernetes Meetup Tokyo #8 Self-hosted Kubernetes を調べてみた
Kubernetes Meetup Tokyo #8 Self-hosted Kubernetes を調べてみた
 
Juju/MAASで作る Kubernetes + GPU
Juju/MAASで作る Kubernetes + GPUJuju/MAASで作る Kubernetes + GPU
Juju/MAASで作る Kubernetes + GPU
 
[GKE & Spanner 勉強会] GKE 入門
[GKE & Spanner 勉強会] GKE 入門[GKE & Spanner 勉強会] GKE 入門
[GKE & Spanner 勉強会] GKE 入門
 
[Cloud OnAir] Google Cloud 主催イベント Anthos Day 情報 2020 年 2 月 13 日放送
[Cloud OnAir] Google Cloud 主催イベント Anthos Day 情報 2020 年 2 月 13 日放送[Cloud OnAir] Google Cloud 主催イベント Anthos Day 情報 2020 年 2 月 13 日放送
[Cloud OnAir] Google Cloud 主催イベント Anthos Day 情報 2020 年 2 月 13 日放送
 
Rancher 2.0 Technical Preview & Bluemix Kubernetes Cluster Import
Rancher 2.0 Technical Preview & Bluemix Kubernetes Cluster ImportRancher 2.0 Technical Preview & Bluemix Kubernetes Cluster Import
Rancher 2.0 Technical Preview & Bluemix Kubernetes Cluster Import
 
kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-
kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-
kubetnetes etc.. & Rancher2.0 Technical Preview -import BLUMIX K8S Clusters-
 
Running Kubernetes on Azure
Running Kubernetes on AzureRunning Kubernetes on Azure
Running Kubernetes on Azure
 
[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...
[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...
[Cloud OnAir] Config Connector の特徴と、 Anthos Config Management を 組み合わせた、 構成管理の...
 
【K.M】Kubernetes.pdf
【K.M】Kubernetes.pdf【K.M】Kubernetes.pdf
【K.M】Kubernetes.pdf
 

Krustlet101