--- title: Deployment # 簡報的名稱 tags: K8s # 簡報的標籤 --- # Deployment > [name=李俊毅] > [time=Wed, Feb 5, 2020 1:04 PM] --- ## Agenda * 介紹 * 範例 * Deployment與Pod的關係 * 常用的CLI --- ## 介紹 ---- Deployment,可縮寫為Deploy,管理無狀態應用,可以配置Pod在哪個Node上與管理Pod擴展和伸縮,Pod Name為無序命名,命名規則為 Pod Name-加上 UID --- ## 範例 ---- hello-world.yaml ``` apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/name: load-balancer-example name: hello-world spec: replicas: 5 selector: matchLabels: app.kubernetes.io/name: load-balancer-example template: metadata: labels: app.kubernetes.io/name: load-balancer-example spec: containers: - image: gcr.io/google-samples/node-hello:1.0 name: hello-world ports: - containerPort: 8080 ``` --- ## Deployment 與 Pod 的關係 ---- Deployment 是透過 ReplicaSet 控制 Pod ,可以從 describe deploy 上看到  --- ## 常用的CLI ---- ### 查詢 deployment ---- ``` kubectl get deploy ```  ---- ### 確認 deployment 狀況 ---- ``` kubectl describe deploy hello-world ```  ---- ### 查看或修改運行中 deployment ---- ``` kubectl edit deploy hello-world ```  ---- ### 查看 Pod ``` kubectl get pods -o wide ``` ---- 
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.