# kubectl apply -f nginx-deployment.yaml --record deployment.apps/nginx-deployment created
查看Deployment – 实时状态
1 2 3 4 5
# kubectl rollout status deployment/nginx-deployment Waiting for deployment "nginx-deployment" rollout to finish: 0 of 3 updated replicas are available... Waiting for deployment "nginx-deployment" rollout to finish: 1 of 3 updated replicas are available... Waiting for deployment "nginx-deployment" rollout to finish: 2 of 3 updated replicas are available... deployment "nginx-deployment" successfully rolled out
# kubectl rollout status deployment/nginx-deployment Waiting for deployment "nginx-deployment" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 1 out of 3 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 2 out of 3 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deployment" rollout to finish: 1 old replicas are pending termination... deployment "nginx-deployment" successfully rolled out
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# kubectl describe deployment nginx-deployment ... OldReplicaSets: <none> NewReplicaSet: nginx-deployment-69c44dfb78 (3/3 replicas created) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 26m deployment-controller Scaled up replica set nginx-deployment-5d59d67564 to 3 Normal ScalingReplicaSet 57s deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 1 Normal ScalingReplicaSet 55s deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 2 Normal ScalingReplicaSet 55s deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 2 Normal ScalingReplicaSet 52s deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 1 Normal ScalingReplicaSet 52s deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 3 Normal ScalingReplicaSet 50s deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 0
1 2 3 4
# kubectl get rs NAME DESIRED CURRENT READY AGE nginx-deployment-5d59d67564 0 0 0 28m nginx-deployment-69c44dfb78 3 3 3 2m44s
# kubectl rollout status deployment/nginx-deployment Waiting for deployment "nginx-deployment" rollout to finish: 3 of 4 updated replicas are available... deployment "nginx-deployment" successfully rolled out
# kubectl get rs NAME DESIRED CURRENT READY AGE nginx-deployment-5d59d67564 0 0 0 58m nginx-deployment-69c44dfb78 4 4 4 32m
# kubectl describe deployment nginx-deployment ... OldReplicaSets: <none> NewReplicaSet: nginx-deployment-69c44dfb78 (4/4 replicas created) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 58m deployment-controller Scaled up replica set nginx-deployment-5d59d67564 to 3 Normal ScalingReplicaSet 33m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 1 Normal ScalingReplicaSet 33m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 2 Normal ScalingReplicaSet 33m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 2 Normal ScalingReplicaSet 33m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 1 Normal ScalingReplicaSet 33m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 3 Normal ScalingReplicaSet 33m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 0 Normal ScalingReplicaSet 60s deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 4
# kubectl get rs NAME DESIRED CURRENT READY AGE nginx-deployment-5d59d67564 0 0 0 68m nginx-deployment-69c44dfb78 3 3 3 42m nginx-deployment-d645d84b6 2 2 0 24s
# kubectl describe deployment nginx-deployment ... OldReplicaSets: <none> NewReplicaSet: nginx-deployment-69c44dfb78 (4/4 replicas created) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 49m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 1 Normal ScalingReplicaSet 49m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 2 Normal ScalingReplicaSet 49m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 2 Normal ScalingReplicaSet 49m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 1 Normal ScalingReplicaSet 49m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 3 Normal ScalingReplicaSet 49m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 0 Normal ScalingReplicaSet 7m25s deployment-controller Scaled up replica set nginx-deployment-d645d84b6 to 1 Normal ScalingReplicaSet 7m25s deployment-controller Scaled down replica set nginx-deployment-69c44dfb78 to 3 Normal ScalingReplicaSet 7m25s deployment-controller Scaled up replica set nginx-deployment-d645d84b6 to 2
# kubectl rollout undo deployment/nginx-deployment deployment.apps/nginx-deployment rolled back
# kubectl get rs NAME DESIRED CURRENT READY AGE nginx-deployment-5d59d67564 0 0 0 72m nginx-deployment-69c44dfb78 4 4 4 46m nginx-deployment-d645d84b6 0 0 0 4m54s
# kubectl describe deployment nginx-deployment ... OldReplicaSets: <none> NewReplicaSet: nginx-deployment-69c44dfb78 (4/4 replicas created) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 49m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 1 Normal ScalingReplicaSet 49m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 2 Normal ScalingReplicaSet 49m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 2 Normal ScalingReplicaSet 49m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 1 Normal ScalingReplicaSet 49m deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 3 Normal ScalingReplicaSet 49m deployment-controller Scaled down replica set nginx-deployment-5d59d67564 to 0 Normal ScalingReplicaSet 7m25s deployment-controller Scaled up replica set nginx-deployment-d645d84b6 to 1 Normal ScalingReplicaSet 7m25s deployment-controller Scaled down replica set nginx-deployment-69c44dfb78 to 3 Normal ScalingReplicaSet 7m25s deployment-controller Scaled up replica set nginx-deployment-d645d84b6 to 2 Normal ScalingReplicaSet 2m36s (x2 over 17m) deployment-controller Scaled up replica set nginx-deployment-69c44dfb78 to 4 Normal ScalingReplicaSet 2m36s deployment-controller Scaled down replica set nginx-deployment-d645d84b6 to 0