Mock-Exam-1 Question # 6 - Getting incorrect answer!

I’m getting this wrong. Attempted this twice.
I did:

  • kubectl create service clusterip messaging-service --tcp=6379:6379 --dry-run=client -o yaml > service.yaml
  • Modified selector to app=redis in the service.yaml file.
  • Modified namespace=marketing in service.yaml file
  • kubectl create -f service.yaml.
    The autograder says that’s wrong. How?

the provided solution is:

  • kubectl expose deployment redis --port=6379 --name=messaging-service --namespace=marketing

what is wrong with the alternative way i did it? Infact I think selector: redis-pod seems wrong, so isn’t my solution correct and the provided solution incorrect?? Please advise. Thanks

Usually the solution is right about these sorts of things. Looks like that’s true here too:

controlplane ~ ➜  k -n marketing get po --show-labels 
NAME                     READY   STATUS    RESTARTS   AGE   LABELS
redis-6f7d7bd7cc-b67h7   1/1     Running   0          62s   name=redis-pod,pod-template-hash=6f7d7bd7cc

1 Like

Ohh, i see, my labels are indeed incorrect…the correct label is name=redis-pod. Thanks for your response.