题目要求 namespace goshawk 中名为 chipmunk-service 的 Service 指向名为 current-chipmunk-deployment 的 Deployment 创建的 5 个 Pod
你可以在 /ckad/goshawk 中找到 current-chipmunk-deployment 的清单文件。
在同一 namespace 中创建一个 相同的 Deployment 名为 canary-chipmunk-deployment
修改 Deployment 以便
在 namespace goshawk 中运行的 Pod 的最大数量为 10 个
chipmunk.servic e 流量的 40% 流向 Pod canary-chipmunk-deployment
参考 https://kubernetes.io/zh-cn/docs/concepts/cluster-administration/manage-deployment/#canary-deployments
解答 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 cd /ckad/goshawk/cp current-chipmunk-deployment.yaml canary-chipmunk-deployment.yaml vim canary-chipmunk-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: canary-chipmunk-deployment namespace: goshawk spec: replicas: 1 selector: matchLabels: app: canary-chipmunk-deployment run: dep-svc template: metadata: labels: app: canary-chipmunk-deployment run: dep-svc spec: containers: - image: vicuu/nginx:hi name: nginx kubectl apply -f canary-chipmunk-deployment.yaml kubectl -n goshawk scale deployment current-chipmunk-deployment --replicas 6 kubectl -n goshawk scale deployment canary-chipmunk-deployment --replicas 4 kubectl -n goshawk get svc -owide for i in {1..1000} ; do curl -qs 10.109.141.220;done | sort |uniq -c