skip to Main Content

When I am running the below command to record the change cause –

kubectl set image deployment.v1.apps/deploy1 nginx=nginx:1.16.0 --record 

Then it is recording the change cause but showing that –record has been deprecated.

Flag --record has been deprecated, --record will be removed in the future
deployment.apps/deploy1 image updated

And when I run the command kubectl set image deployment.v1.apps/deploy1 nginx=nginx:1.16.0 without –record then it is not recording the change cause.

So my question is if the --record has been deprecated and with be removed in the future then what is easy alternative of that to record change? ( I mean to record the command using which I have done rollout ).

Thanks in advance.

2

Answers


  1. Not sure if it’s deprecated or will be fully.

    You can use the annotate to manage the history same way.

    1. Create the deployment

      kubectl create deployment nginx –image=nginx:1.16.0 –replicas 1

    2. check the history

      kubectl rollout history deployment nginx

    3. update the image on deployment

      kubectl set image deployment nginx nginx=nginx:latest

    4. Annotate the deployment now and create the history

      kubectl annotate deployment nginx kubernetes.io/change-cause="version change to 1.16.0 to latest" –overwrite=true

    5. Check the history

      kubectl rollout history deployment nginx

    Login or Signup to reply.
  2. The best way to keep a clean documented history of your rollouts is using:

    kubectl annotate --help
    

    You can use for example:

    kubectl annotate deployment/nginx-deployment kubernetes.io/change-cause="image updated to 1.16.1"
    

    CHANGE-CAUSE is copied from the Deployment annotation kubernetes.io/change-cause to its revisions upon creation.
    Then you would get a message like this when revisiting the history.

    enter image description here

    You can also find the information in the documentation under Workloads -> Resources -> Resources -> Checking Rollout History of a Deployment.

    Kubernetes Documentation

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search