Deployment
Kubernetes 中 Deployment 的基本操作
· ☕ 2 分钟
Deployment 通过创建 ReplicaSet 控制 Pod 的数量、状态。本篇主要介绍一些 Deployment 常用的操作。 1. Deployment yaml 格式 带上 --dry-run 参数表示并不执行命令,仅生成 yaml 输出: 1 kubectl create deployment nginx --image=nginx --dry-run -o yaml apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: nginx name: nginx spec: replicas: 1 selector: matchLabels: app: nginx strategy: {} template: metadata: creationTimestamp: null labels: app: nginx spec: containers: - image: nginx name: nginx resources: {} status: {} 2. 创建 使用 run 参数 1 kubectl run nginx --image=nginx 使用