Ambily Unni:
• Hello, Am unable to understand what’s wrong with my answer for lightning lab-1, qn5. While evaluating, it shows error in step: Deployment created correctly?. All other steps are evaluated as right. checked the solution video as well and it seems similar to mine. Attaching the yaml file
Mohamed Ayman:
If u are asking about the Q4 of the CKA, try
kubectl create deployment nginx-deploy --image=nginx:1.16
kubectl set image deployment/nginx-deploy nginx=nginx:1.17 --record
Ambily Unni:
My qn is on the lightning lab q5 for CKAD
Mohamed Ayman:
in the previous screenshot, right?
Ambily Unni:
your screenshot is not from the ckad lightning lab
Ambily Unni:
I meant this one
Mohamed Ayman:
First you have to create the deployment using this yaml file
Mohamed Ayman:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx-deploy
name: nginx-deploy
namespace: default
spec:
replicas: 4
selector:
matchLabels:
app: nginx-deploy
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 2
type: RollingUpdate
template:
metadata:
labels:
app: nginx-deploy
spec:
containers:
- image: nginx:1.16
imagePullPolicy: IfNotPresent
name: nginx
Mohamed Ayman:
When creating you have to use —record then you can set the image by the same option
$kubectl create -f filename —record
$ kubectl set image deployment nginx-deploy nginx=nginx:1.17 --record
To rollback to the previous state you can simply rollout undo using
$kubectl rollout undo deployment nginx-deploy
Ambily Unni:
Thanks. Figured out what was wrong with my yaml by comparing with yours. I added a strategy section on my own with params but forgot to delete the default strategy section!