Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Write an Operator to handle CRD
Search
Kyle Bai
September 13, 2017
Technology
66
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Write an Operator to handle CRD
Kyle Bai
September 13, 2017
More Decks by Kyle Bai
See All by Kyle Bai
讓 Jenkins 老爺爺掌舵帶領開發者航向美好新世界
kairen
1
300
AWS Startup 2020 - AMIS
kairen
0
100
學習 Kubernetes 不是為了成為 YAML Engineer
kairen
0
390
How to make your container:Kubernetes is a bit more secure
kairen
0
240
Vishwakarma: Terraform modules for deploying EKS and Self-hosting Kubernetes(AWS))
kairen
0
120
Vishwakarma: Terraform modules for deploying EKS and Self-hosting Kubernetes
kairen
0
140
Chatbot as a Service on Container(Kubernetes)
kairen
0
1.1k
IT IRONMAN 2020
kairen
0
120
Advanced Kubernetes For UMC
kairen
0
200
Other Decks in Technology
See All in Technology
Antigravity SDK for the Java Developer
glaforge
0
170
LLMに渡さなかった仕事
nanaism
0
1.3k
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
2
1k
Azure Serverless 2026:Production-ready な AI エージェント基盤 / Azure Serverless 2026: Production-Ready AI Agent Platform
miyake
2
500
Railsのように考える: See through the Master
snoozer05
PRO
5
1.2k
ScotSecure West 2026 - Glasgow
raybugg
0
150
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
1
430
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
EventBridge に「合流」はない ― サーバーレスのワークフローを育てるということ / No Join in EventBridge
yusukeshimizu
2
440
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
2.5k
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
170
SREは、MCPとAutopilotをこう使え!
kazumax55
3
940
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Mobile First: as difficult as doing things right
swwweet
225
10k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Facilitating Awesome Meetings
lara
57
7.1k
RailsConf 2023
tenderlove
30
1.6k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Writing Fast Ruby
sferik
630
63k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
240
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Designing Powerful Visuals for Engaging Learning
tmiket
1
570
The Language of Interfaces
destraynor
162
27k
Transcript
Write an Operator to handle CRD SDN x Cloud Native
#2
About Me Kyle Bai • Interested in emerging technologies. •
COSCUP, Kubernetes Day and OpenStack Day Speaker • OpenStack and Kubernetes Projects Contributor(100+ PR) • Certified Kubernetes Administrator @kairen(
[email protected]
) https://kairen.github.io/
常⾒見見的 Kubernetes 應⽤用部署 • 利利⽤用 CLI 或是 Dashboard 部署指定應⽤用程式的容器⾄至 Kubernetes。
• 撰寫⼀一些 Deployment, Services, Configmaps 等物件資源,然後將這些部 署⾄至 Kubernetes。 • 撰寫應⽤用程式的 Helm Chart,並利利⽤用 Helm 來來進⾏行行部署。 • 或是其他⼯工具等
1.假設有 Config 需要設定,我們需要先建立 ConfigMap 2.然後建立 RC 來來管理理 Pod,並在 Pod 描述
ConfigMap 使⽤用⽅方式 3.建立 Service 來來提供 Backend Pod 能夠對外提供存取 4.建立 Frontend Pod 來來連接 Backend Pod
1.設計與開發 Helm Chart 2.安裝 Helm 到⾃自⼰己 Kubernetes 3.利利⽤用 Helm 來來部署
Chart ⾄至 Kubernetes
有狀狀態服務(Stateful Service) Database: MySQL, MongoDB Data process: Spark, Hadoop DL/ML:
TensorFlow, Caffe2 Storage: Gluster, Ceph Logging: Elasticsearch
TensorFlow on Kubernetes Step1: 包裝 Workers 與 Parameters 的程式成 Docker
images Step2: 建立 TensorFlow 叢集需要的資訊⾄至 ConfigMap 與 Persistent Volume Step3: 定義叢集的 Deployment 與 Service 等等來來執⾏行行於 Kubernetes 中
https://github.com/tensorflow/k8s TensorFlow Kubernetes Operator
Operator Operator 是 CoreOS 開發的框 架,⽬目標是簡化複雜有狀狀態應⽤用 的管理理,它能夠達到應⽤用程式的 狀狀態事件變化,並利利⽤用控制器來來 透過擴展的 Kubernetes
API 進⾏行行 ⾃自動建立、管理理與配置應⽤用程式 容器實例例。 Applications
Operator Pattern
• Reflector: Watch API,監聽指定資 源下的事件。 • Lister: List/Get Method。 •
Informer: 資源變更更通知與輪輪詢。
None
None
CustomResourceDefinitions(CRD) CustomResourceDefinition(CRD) 是 v1.7+ 版本新加入的 Kubernetes API 擴 展機制,⽬目標是無需修改核⼼心程式碼就能對 Kubernetes
進⾏行行擴展,⽽而 CRD 更更是 ThirdPartyResources(TPR) 的升級版。 • 使⽤用⾃自定義物件進⾏行行擴展 Kubernetes API. • CRDs 能夠沿⽤用熟係的 UX ⼯工具,ex: kubectl. • 能夠與 Controllers 進⾏行行結合. • ⽀支援 SubResources(v1.10+).
CRD Example(1/2)
CRD Example(2/2)
Add operator to handle events
Step 1: 設計 API types(1/2) • TypeMeta 與 ObjectMeta 是
Kubernetes 基本資源屬性,如 .metadata.name 等。 • Spec 定義⾃自⼰己資源的屬性內容。 • Status 反應⽬目前資源狀狀態資訊。
Step 2: 註冊 API 當設計好 API types 結構後,需要將要使⽤用資源物件加入⾄至 apimachinery 的
Runtime schema 中。
Step 3: 產⽣生 Client code(1/2) 當註冊完成後,利利⽤用 k8s.io/code- generator 來來產⽣生指定 API
的 Clientset 來來便便利利存取該 API 的資源物件。
Step 3: 產⽣生 Client code(2/2)
Step 4: 透過 Client 建立 CRD 資源
Step 5: 註冊事件 最後註冊事件來來進⾏行行監聽資源變化,分析變化狀狀態來來進⾏行行對應事情。
Demo https://github.com/kairen/simple-operator
幾個設計原則 • Operators should not be too big • Operators
should have single responsibilities • Operators should keep simple and maintainable • Complex Cluster should be managed by a group of interacting micro- operators • Use Deployment to deploy operators
Refers • code-generator • crd-code-generation • apiextensions-apiserver • sample-apiserver •
sample-controller • apimachinery • apiserver-builder/example • kube-openapi • service-catalog
Thanks