$ k get deployments.apps -owide NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR nginx-deployment 2/2 2 2 57s nginx nginx:alpine app=nginx-deployment
$ k get rs -owide NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR nginx-deployment-756d6b7586 2 2 2 114s nginx nginx:alpine app=nginx-deployment,pod-template-hash=756d6b7586
$ k get po -owide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-deployment-756d6b7586-dcbnz 1/1 Running 0 19s 10.10.1.73 mac-worker <none> <none> nginx-deployment-756d6b7586-l9cwt 1/1 Running 0 19s 10.10.1.74 mac-worker <none> <none>
$ k apply -f nginx-deploy-v1.yaml deployment.apps/nginx-deploy created
$ k get deployments.apps -owide NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR nginx-deploy 4/4 4 4 22s nginx nginx:1.21-alpine app=nginx-deploy
$ k get replicasets.apps -owide NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR nginx-deploy-96dd47d99 4 4 4 39s nginx nginx:1.21-alpine app=nginx-deploy,pod-template-hash=96dd47d99
$ k get po -owide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-deploy-96dd47d99-cb6pk 1/1 Running 0 54s 10.10.1.87 mac-worker <none> <none> nginx-deploy-96dd47d99-l4jvp 1/1 Running 0 54s 10.10.1.85 mac-worker <none> <none> nginx-deploy-96dd47d99-pqk55 1/1 Running 0 54s 10.10.1.86 mac-worker <none> <none> nginx-deploy-96dd47d99-wmgnv 1/1 Running 0 54s 10.10.1.88 mac-worker <none> <none>
$ k apply -f nginx-deploy-v2.yaml deployment.apps/nginx-deploy configured
$ k rollout status deployment nginx-deploy Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 3 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... deployment "nginx-deploy" successfully rolled out
$ k get deployments.apps -owide NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR nginx-deploy 4/4 4 4 10m nginx nginx:1.22-alpine app=nginx-deploy
$ k get replicasets.apps -owide NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR nginx-deploy-5b545d7468 4 4 4 3m43s nginx nginx:1.22-alpine app=nginx-deploy,pod-template-hash=5b545d7468 nginx-deploy-96dd47d99 0 0 0 10m nginx nginx:1.21-alpine app=nginx-deploy,pod-template-hash=96dd47d99
$ k get po -owide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-deploy-5b545d7468-69qlj 1/1 Running 0 4m1s 10.10.1.89 mac-worker <none> <none> nginx-deploy-5b545d7468-gvqvp 1/1 Running 0 3m43s 10.10.1.91 mac-worker <none> <none> nginx-deploy-5b545d7468-jt4lx 1/1 Running 0 4m 10.10.1.90 mac-worker <none> <none> nginx-deploy-5b545d7468-nqblh 1/1 Running 0 3m43s 10.10.1.92 mac-worker <none> <none>
$ k describe deployments.apps nginx-deploy Name: nginx-deploy Namespace: default CreationTimestamp: Wed, 28 Jun 2022 00:54:35 +0000 Labels: <none> Annotations: deployment.kubernetes.io/revision: 2 Selector: app=nginx-deploy Replicas: 4 desired | 4 updated | 4 total | 4 available | 0 unavailable StrategyType: RollingUpdate MinReadySeconds: 16 RollingUpdateStrategy: 25% max unavailable, 25% max surge Pod Template: Labels: app=nginx-deploy Containers: nginx: Image: nginx:1.22-alpine Port: 80/TCP Host Port: 0/TCP Environment: <none> Mounts: /etc/nginx/conf.d from nginx-conf-vol (rw) Volumes: nginx-conf-vol: Type: ConfigMap (a volume populated by a ConfigMap) Name: nginx-conf Optional: false Conditions: Type Status Reason ---- ------ ------ Available True MinimumReplicasAvailable Progressing True NewReplicaSetAvailable OldReplicaSets: <none> NewReplicaSet: nginx-deploy-5b545d7468 (4/4 replicas created) Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 11m deployment-controller Scaled up replica set nginx-deploy-96dd47d99 to 4 Normal ScalingReplicaSet 5m9s deployment-controller Scaled up replica set nginx-deploy-5b545d7468 to 1 Normal ScalingReplicaSet 5m9s deployment-controller Scaled down replica set nginx-deploy-96dd47d99 to 3 Normal ScalingReplicaSet 5m8s deployment-controller Scaled up replica set nginx-deploy-5b545d7468 to 2 Normal ScalingReplicaSet 4m51s deployment-controller Scaled down replica set nginx-deploy-96dd47d99 to 1 Normal ScalingReplicaSet 4m51s deployment-controller Scaled up replica set nginx-deploy-5b545d7468 to 4 Normal ScalingReplicaSet 4m34s deployment-controller Scaled down replica set nginx-deploy-96dd47d99 to 0
$ k rollout undo deployment nginx-deploy --to-revision=1 deployment.apps/nginx-deploy rolled back
$ k rollout status deployment nginx-deploy Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 3 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... deployment "nginx-deploy" successfully rolled out
$ k get replicasets.apps -owide NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR nginx-deploy-5b545d7468 0 0 0 23m nginx nginx:1.22-alpine app=nginx-deploy,pod-template-hash=5b545d7468 nginx-deploy-96dd47d99 4 4 4 30m nginx nginx:1.21-alpine app=nginx-deploy,pod-template-hash=96dd47d99
$ k describe deployments.apps nginx-deploy ... Annotations: deployment.kubernetes.io/revision: 3 .... Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ScalingReplicaSet 23m deployment-controller Scaled up replica set nginx-deploy-5b545d7468 to 1 Normal ScalingReplicaSet 23m deployment-controller Scaled down replica set nginx-deploy-96dd47d99 to 3 Normal ScalingReplicaSet 23m deployment-controller Scaled up replica set nginx-deploy-5b545d7468 to 2 Normal ScalingReplicaSet 23m deployment-controller Scaled down replica set nginx-deploy-96dd47d99 to 1 Normal ScalingReplicaSet 23m deployment-controller Scaled up replica set nginx-deploy-5b545d7468 to 4 Normal ScalingReplicaSet 22m deployment-controller Scaled down replica set nginx-deploy-96dd47d99 to 0 Normal ScalingReplicaSet 3m15s deployment-controller Scaled up replica set nginx-deploy-96dd47d99 to 1 Normal ScalingReplicaSet 3m15s deployment-controller Scaled down replica set nginx-deploy-5b545d7468 to 3 Normal ScalingReplicaSet 3m15s deployment-controller Scaled up replica set nginx-deploy-96dd47d99 to 2 Normal ScalingReplicaSet 2m58s (x2 over 30m) deployment-controller Scaled up replica set nginx-deploy-96dd47d99 to 4 Normal ScalingReplicaSet 2m58s deployment-controller Scaled down replica set nginx-deploy-5b545d7468 to 1 Normal ScalingReplicaSet 2m40s deployment-controller Scaled down replica set nginx-deploy-5b545d7468 to 0
$ k rollout history deployment nginx-deploy deployment.apps/nginx-deploy REVISION CHANGE-CAUSE 2 <none> 3 <none>
$ k rollout history deployment nginx-deploy --revision=3 deployment.apps/nginx-deploy with revision #3 Pod Template: Labels: app=nginx-deploy pod-template-hash=96dd47d99 Containers: nginx: Image: nginx:1.21-alpine Port: 80/TCP Host Port: 0/TCP Environment: <none> Mounts: /etc/nginx/conf.d from nginx-conf-vol (rw) Volumes: nginx-conf-vol: Type: ConfigMap (a volume populated by a ConfigMap) Name: nginx-conf Optional: false
$ k apply -f nginx-cm.yaml -f nginx-deploy-v1.yaml configmap/nginx-conf created deployment.apps/nginx-deploy created
$ k rollout history deployment nginx-deploy deployment.apps/nginx-deploy REVISION CHANGE-CAUSE 1 v1, nginx=1.21
$ k apply -f nginx-deploy-v2.yaml deployment.apps/nginx-deploy configured
$ k rollout status deployment nginx-deploy Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 2 out of 4 new replicas have been updated... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... Waiting for deployment "nginx-deploy" rollout to finish: 1 old replicas are pending termination... deployment "nginx-deploy" successfully rolled out
$ k rollout history deployment nginx-deploy deployment.apps/nginx-deploy REVISION CHANGE-CAUSE 1 v1, nginx=1.21 2 v2, nginx=1.22