$ kubectl create -f docs/user-guide/nginx-deployment.yaml --record deployment "nginx-deployment」 created
$ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 3 0 0 0 1s
$ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 3 3 3 3 18s
$ kubectl get rs NAME DESIRED CURRENT AGE nginx-deployment-2035384211 3 3 18s
$ kubectl get pods --show-labels NAME READY STATUS RESTARTS AGE LABELS nginx-deployment-2035384211-7ci7o 1/1 Running 0 18s app=nginx,pod-template-hash=2035384211 nginx-deployment-2035384211-kzszj 1/1 Running 0 18s app=nginx,pod-template-hash=2035384211 nginx-deployment-2035384211-qqcnn 1/1 Running 0 18s app=nginx,pod-template-hash=2035384211
$ kubectl rollout status deployment/nginx-deployment deployment "nginx-deployment" successfully rolled out
kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1 deployment "nginx-deployment" image updated
$ kubectl edit deployment/nginx-deployment deployment "nginx-deployment" edited
$ kubectl rollout status deployment/nginx-deployment Waiting for rollout to finish: 2 out of 3 new replicas have been updated... deployment "nginx-deployment" successfully rolled out若是發佈成功
$ kubectl get deployments NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE nginx-deployment 3 3 3 3 36s
$ kubectl get rs NAME DESIRED CURRENT AGE nginx-deployment-1564180365 3 3 6s nginx-deployment-2035384211 0 0 36s
$ kubectl get pods NAME READY STATUS RESTARTS AGE nginx-deployment-1564180365-khku8 1/1 Running 0 14s nginx-deployment-1564180365-nacti 1/1 Running 0 14s nginx-deployment-1564180365-z9gth 1/1 Running 0 14s更新pod,咱們只需更新deployment裏面的templement
$ kubectl describe deployment
$ kubectl rollout history deployment/nginx-deployment能夠回滾至任一個以前的版本
$ kubectl rollout undo deployment/nginx-deployment deployment "nginx-deployment" rolled back
$ kubectl rollout undo deployment/nginx-deployment --to-revision=2 deployment "nginx-deployment" rolled back
ou can scale a Deployment by using the following command:nginx
$ kubectl scale deployment nginx-deployment --replicas 10 deployment "nginx-deployment" scaled
$ kubectl autoscale deployment nginx-deployment --min=10 --max=15 --cpu-percent=80 deployment "nginx-deployment" autoscaled
$ kubectl set image deployment/nginx-deployment nginx=nginx:1.9.1; kubectl rollout pause deployment/nginx-deployment deployment "nginx-deployment" image updated deployment "nginx-deployment" paused