Kubernetes CKA sample exam question 95 with answer

Question
There is a Deployment in Namespace application1 which seems to have issues and is not getting ready.
Fix it by only editing the Deployment itself and no other resources.

Answer
Get details about deploy:

kubectl -n application1 get deploy
can be observed deploy api with the READY field as 0/3 which means that out of 3 pods - 0 are ready.
Get more info:
kubectl -n application1 describe deploy api
this won't help us much - nothing is there in terms of warnings or errors
Try other way:
kubectl -n application1 logs deployments/api
We are getting:
Error from server (BadRequest): container "httpd" in pod "api-75bdbf4d57-cj6b7" is waiting to start: CreateContainerConfigError
Get the pods:
kubectl -n application1 get po
And try to get events from a pod:
kubectl -n application1 describe po api-75bdbf4d57-wsgsc
There is one of message that can catch attention:
Error: configmap "category" not found
Check above - the configmap category is used in this line:
Environment:
  CATEGORY:  <set to the key 'category' of config map 'category'>  Optional: false
Check the configmaps:
kubectl -n application1 get cm
It is not category - it is configmap-category by name:
configmap-category   1      3m41s
So, we need edit the deployment:
kubectl -n application1 edit deploy api
and to change the name of configmap in it:
spec:
  template:
    spec:
      containers:
      - env:
        - name: CATEGORY
          valueFrom:
            configMapKeyRef:
              key: category
              name: configmap-category
Save and exit,
After some time, the deployment will be functional