From the cka mock 1:
#q16:
For this question, please set the context to cluster1 by running:
kubectl config use-context cluster1
There is a script located at /root/pod-cka26-arch.sh on the student-node. Update this script to add a command to filter/display the label with value component of the pod called kube-apiserver-cluster1-controlplane (on cluster1) using jsonpath.
i added my answer:
student-node ~ ➜ cat pod-cka26-arch.sh
#!/bin/bash
kubectl -n kube-system get po kube-apiserver-cluster1-controlplane -ojsonpath=“{.metadata.labels.component}”
but it reported as incorrect answer.
#-------
another question
#q17
For this question, please set the context to cluster3 by running:
kubectl config use-context cluster3
There is a deployment nginx-deployment-cka04-svcn in cluster3 which is exposed using service nginx-service-cka04-svcn.
Create an ingress resource nginx-ingress-cka04-svcn to load balance the incoming traffic with the following specifications:
pathType: Prefix and path: /
Backend Service Name: nginx-service-cka04-svcn
Backend Service Port: 80
ssl-redirect is set to false
I created the ingress resource but it couldn’t create a address, see it so i cannot test it. I think there was no ingress controller on the cluster when i checked.
student-node ~ ➜ kubectl config use-context cluster3
Switched to context “cluster3”.
student-node ~ ➜ k get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
nginx-ingress-cka04-svcn nginx-example * 80 13m
Hi @sreenivasc
For Q16, it mentions ... pod called kube-apiserver-cluster1-controlplane **(on cluster1)**
. Note the (cluster1)
here. You have to append the --context cluster1
flag to this command:
#!/bin/bash
kubectl --context cluster1 get pod -n kube-system kube-apiserver-cluster1-controlplane -o jsonpath='{.metadata.labels.component}'
For Q17, I think you missed defining the ssl-redirect
annotation on the ingress resource.
I hope this helps!
hello @Santosh_KodeKloud , thanks for your reply.
#16:
you don’t have to add --context
as you would run by setting the context before running command
#17: i created the ingress with the ssl-rewrite
annotation; I don’t think this will make any difference whether setting or not ssl-rewrite for the ingress to actually create an ip address.
For Q16, true that the --context
flag can be avoided, but the requirement is outlined in the task description, and the grader checks the flag as well. This is mainly a grader requirement, if the --context
is not present while validating the task, the grader runs the script in the context last set in the terminal, which could be a wrong context. So we explicitly set the context in the command.
For Q17
The task requirement has mentioned: ssl-redirect is set to false
. This is a requirement for the task to result in a pass.
In your ingress output, I don’t see the ADDRESS column. The lab does have Traefik ing controller installed.
This may be a transient error. Can you please try this lab again?
@Santosh_KodeKloud I found the issue with #q17.
See the ingress.yaml content but then i copied the ingress resource directly from the kubernetes documentation and did not remove the ingressClassName: nginx-example
which means that it was using wrong ingress class name. I removed that line from the ingress and then it was able to create the address.
See the other screenshot after updated the ingress.yaml , created the ingress and then it created & showed the ip address.