1.
[root@k8s-master ~]# kubectl rollout history deployment kubernetes-bootcamp
deployment.apps/kubernetes-bootcamp
REVISION CHANGE-CAUSE
1 <none>
[root@k8s-master ~]# kubectl scale deployment/kubernetes-bootcamp --replicas=2
deployment.apps/kubernetes-bootcamp scaled
[root@k8s-master ~]# kubectl describe deploy/kubernetes-bootcamp
Name: kubernetes-bootcamp
Namespace: default
CreationTimestamp: Sun, 12 Jan 2020 14:19:31 +0800
Labels: run=kubernetes-bootcamp
Annotations: deployment.kubernetes.io/revision: 1
Selector: run=kubernetes-bootcamp
Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: run=kubernetes-bootcamp
Containers:
kubernetes-bootcamp:
Image: docker.io/jocatalin/kubernetes-bootcamp:v1
Port: 8080/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Progressing True NewReplicaSetAvailable
Available True MinimumReplicasAvailable
OldReplicaSets: <none>
NewReplicaSet: kubernetes-bootcamp-dd9784f6 (2/2 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 11s deployment-controller Scaled up replica set kubernetes-bootcamp-dd9784f6 to 2
[root@k8s-master ~]# kubectl set image deploy/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
deployment.apps/kubernetes-bootcamp image updated
[root@k8s-master ~]# kubectl describe deploy/kubernetes-bootcamp
Name: kubernetes-bootcamp
Namespace: default
CreationTimestamp: Sun, 12 Jan 2020 14:19:31 +0800
Labels: run=kubernetes-bootcamp
Annotations: deployment.kubernetes.io/revision: 2
Selector: run=kubernetes-bootcamp
Replicas: 2 desired | 2 updated | 2 total | 2 available | 0 unavailable
StrategyType: RollingUpdate
MinReadySeconds: 0
RollingUpdateStrategy: 25% max unavailable, 25% max surge
Pod Template:
Labels: run=kubernetes-bootcamp
Containers:
kubernetes-bootcamp:
Image: jocatalin/kubernetes-bootcamp:v2
Port: 8080/TCP
Host Port: 0/TCP
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: kubernetes-bootcamp-7d6f8694b6 (2/2 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 62s deployment-controller Scaled up replica set kubernetes-bootcamp-dd9784f6 to 2
Normal ScalingReplicaSet 10s deployment-controller Scaled up replica set kubernetes-bootcamp-7d6f8694b6 to 1
Normal ScalingReplicaSet 8s deployment-controller Scaled down replica set kubernetes-bootcamp-dd9784f6 to 1
Normal ScalingReplicaSet 8s deployment-controller Scaled up replica set kubernetes-bootcamp-7d6f8694b6 to 2
Normal ScalingReplicaSet 6s deployment-controller Scaled down replica set kubernetes-bootcamp-dd9784f6 to 0
[root@k8s-master ~]# kubectl rollout history deploy/kubernetes-bootcamp
deployment.apps/kubernetes-bootcamp
REVISION CHANGE-CAUSE
1 <none>
2 <none>
[root@k8s-master ~]# kubectl rollout undo deploy/kubernetes-bootcamp --to-revision=1
deployment.apps/kubernetes-bootcamp rolled back
[root@k8s-master ~]# kubectl get deploy/kubernetes-bootcamp -owide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
kubernetes-bootcamp 2/2 2 2 3h1m kubernetes-bootcamp docker.io/jocatalin/kubernetes-bootcamp:v1 run=kubernetes-bootcamp
[root@k8s-master ~]# kubectl rollout history deploy/kubernetes-bootcamp
deployment.apps/kubernetes-bootcamp
REVISION CHANGE-CAUSE
2 <none>
3 <none>
[root@k8s-master ~]# kubectl set image deploy/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2 --record
deployment.apps/kubernetes-bootcamp image updated
[root@k8s-master ~]# kubectl get deploy/kubernetes-bootcamp -owide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
kubernetes-bootcamp 2/2 2 2 3h2m kubernetes-bootcamp jocatalin/kubernetes-bootcamp:v2 run=kubernetes-bootcamp
[root@k8s-master ~]# kubectl rollout history deploy/kubernetes-bootcamp
deployment.apps/kubernetes-bootcamp
REVISION CHANGE-CAUSE
3 <none>
4 kubectl set image deploy/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2 --record=true
[root@k8s-master ~]#