<#CDR9R5QRG|general> I have an issue with CKA practice test course- Node Affinit . . .

emden Lee:
<#CDR9R5QRG|general> I have an issue with CKA practice test course- Node Affinity Lab question 6. I got an error message complaining line 112 which is where you start the affinity section in the yaml file. I couldn’t figure out what’s wrong. I did exactly what’s showed in the demo. Can anyone help?

Mohamed Ayman:
Hi @emden Lee,
check the following to complete the lab:
Step 1:
kubectl create deployment blue --image=nginx --dry-run=client -o yaml &gt; blue.yaml
Step 2:
vi blue.yaml
Step 3:
copy the following section from /var/answers/blue-deployment.yaml and put it in blue.yaml :
- matchExpressions:
- key: color
operator: In
- blue
step 4:
kubectl apply -f blue.yaml

emden Lee:
Thanks MAyman, your approach works. But I just don’t know why the approach that was showed in the Solution demon video doesn’t work on me. The solution is like this: The deployment blue was already create on question 4 by the command <kubectl create deployment blue --image=nginx so on question 6, the teacher use these steps: step1 <kubectl get deployment blue -o yaml > blue.yaml Step 2. <vi blue.yaml , update yaml by adding that affinity section. Then I got that error message. It works on teacher but doesn’t work on me.