'Kubernetes Change-Cause
I don't know why the change cause below is always kubectl create although I run different kubectl commands. The second revision should be 'kubectl apply' not 'kubectl create' and the third should be 'kubectl set image'.
I am running Kubernetes v1.18.5
[garfield@kubemaster1 Kube]$ kubectl rollout history deployment/myapp-deployment
deployment.apps/myapp-deployment
REVISION CHANGE-CAUSE
1 kubectl create --filename=deployment-definition.yml --record=true
2 kubectl create --filename=deployment-definition.yml --record=true
[garfield@kubemaster1 Kube]$ kubectl set image deployment.apps/myapp-deployment nginx-container=nginx:1.12-perl
deployment.apps/myapp-deployment image updated
[garfield@kubemaster1 Kube]$ kubectl rollout history deployment/myapp-deployment
deployment.apps/myapp-deployment
REVISION CHANGE-CAUSE
1 kubectl create --filename=deployment-definition.yml --record=true
2 kubectl create --filename=deployment-definition.yml --record=true
3 kubectl create --filename=deployment-definition.yml --record=true
UPDATE: I should have added --record at the end of every kubectl command
Solution 1:[1]
I should have added --record at the end of every kubectl.
Adding more details:
--record
: Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If not set, default to updating the existing annotation value only if one already exists.
Solution 2:[2]
I hava a same problem with you.
# kubectl set image deployment/nginx-deployment nginx-deployment=nginx:1.9.1
deployment.apps/nginx-deployment image updated
# kubectl rollout history deployment/nginx-deployment
deployment.apps/nginx-deployment REVISION CHANGE-CAUSE 1 kubectl apply --filename=nginx-deployment.yaml --record=true 2 kubectl apply --filename=nginx-deployment.yaml --record=true
Solution 3:[3]
The kubectl set image or apply command doesn't record the changes by default in order to record it we need to set --record = true or just --record
But the point to be noted is the --record is depicted since 2018 and K8s official documentation still teaches --record You can use it until K8s provides an alternative
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Wytrzymały Wiktor |
Solution 2 | david_he |
Solution 3 | Shithanshu |