Ex 4 of the "Lightning Lab - 1" in CKA course

Hello,

I am asked to roll upgrade the deploy and record a message.
How can I do so? the option --record seems to be deprecated?

Thanks

Hi,

You can use kubectl annotate deployment Kubernetes - kubectl annotate
For example: kubectl annotate deployment nginx kubernetes.io/change-cause=“Updated nginx image to 1.17”

Hi @Mundofik

Your command to update the image is partially correct. The --record flag is a boolean flag. If defined its set to true and records the current kubectl command in the resource annotation.

So, the command should be k set image deploy nginx-deploy nginx=nginx:1.17 --record

Now the issue with the is, it defines the annotation to be as Updated nginx image to 1.17. Whereas, the --record flag records the command that was executed, in this case, it was kubectl set image ....

I will notify the lab’s team as well to update the question.

Hope this helps.

Hello @Santosh_KodeKloud , thank you.
So I can only pass --record without additional info.

Will the annotation mentioned by Raymond above work or not?
For example first thing I run the kubectl set image deploy.. command, then I add the annotation with the extra message requested.

Thanks again.

The solution provided by Raymond will work as well.

The issue with that route is that annotation needs a key and value. But, the question provides only the value to the Annotation: Updated nginx image to 1.17`, and what should be the key is missing in the question.

I tried with k annotate deploy nginx-deploy message="Updated nginx image to 1.17". And the validation resulted in a pass.

The issue here is the key message is not defined in the question, or defined subtly.
:slight_smile:

Got it, thanks a lot!

--record has been deprecated for around 7 years now, but it still works. While it does, it can be used.

1 Like