Hi Guys, For this test: Create a new deployment called `nginx-deploy`, with ima . . .

JIAN ZHAO:
Hi Guys,

For this test:
Create a new deployment called nginx-deploy, with image nginx:1.16 and 1 replica. Record the version. Next upgrade the deployment to version 1.17 using rolling update. Make sure that the version upgrade is recorded in the resource annotation.

How can I record the first step ? it is not available for “kubectl create deploy --record”

I checked the solution video, the instructor seems to use “kubectl run” for deployment. I assume it was a legacy usage for deployment ?

JIAN ZHAO:
my rollout looks like this:

REVISION CHANGE-CAUSE
1 <none>
2 kubectl set image deploy nginx-deploy nginx=nginx:1.17 --record=true

because I don’t know how to record first step…

Tej_Singh_Rana:
> I checked the solution video, the instructor seems to use “kubectl run” for deployment.
In the previous version of k8s, kubectl run command used to create a deployment instead of a pod.
In the current version, it used to create a pod.
To create a deployment, we use kubectl create deployment command.

Tej_Singh_Rana:
> because I don’t know how to record first step…
You can save deployment YAML into a new file and record it when you’re going to create.

kubectl create deployment nginx-deploy --image=nginx:1.16 --dry-run=client -oyaml &gt; d1.yaml
kubectl create -f d1.yaml --record

Tej_Singh_Rana:
Information for each command and it’s options:
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands

JIAN ZHAO:
thanks Tej. I’ll take a look.

Mohamed Ayman:
You can also use --record when setting the image nginx:1.17

Mohamed Ayman:
Check the following steps:

kubectl create deployment nginx-deploy --image=nginx:1.16 --replicas=1
kubectl get deploy

Mohamed Ayman:
Then

kubectl set image deployment nginx-deploy nginx=nginx:1.17 --record
kubectl rollout history deployment nginx-deploy