CKA · Question #52
Create a new Ingress resource as follows: Name: echo Namespace: sound-repeater The availability of Service echoserver-service can be checked using the following command, which should return 200 :
The user needs to create a Kubernetes Ingress resource named 'echo' in the 'sound-repeater' namespace, configured to route root path traffic to the 'echoserver-service' on port 80.
Question
- Name: echo
- Namespace: sound-repeater The availability of Service echoserver-service can be checked using the following command, which should return 200 :
Exhibit
Explanation
The user needs to create a Kubernetes Ingress resource named 'echo' in the 'sound-repeater' namespace, configured to route root path traffic to the 'echoserver-service' on port 80.
Approach. The user must type the following command into the web terminal to create the Ingress resource:
kubectl create ingress echo --namespace sound-repeater --rule="/=echoserver-service:80"
Common mistakes.
- common_mistake. 1. Incorrect Namespace: Creating the Ingress in the default namespace or any other namespace (e.g., 'development' as seen in the exhibit) instead of 'sound-repeater' would result in failure, as the resource would not be found or validated correctly in the specified location.
- Incorrect Service Name or Port: Misspelling
echoserver-serviceor specifying an incorrect port (e.g., 8080 if 80 is expected) would prevent the Ingress from successfully routing traffic to the backend service, leading to connectivity issues or non-200 responses. - Missing or Incorrect Rule/Backend: Failing to specify a routing rule (
--rule) or a default backend (--default-backend) would create an Ingress that does not direct any traffic to theechoserver-service, making it non-functional. - Syntax Errors: Any typos or incorrect
kubectlcommand syntax would prevent the Ingress resource from being created successfully. If a YAML file is chosen instead, missingapiVersion,kind, or incorrect indentation/field names would also cause errors. - Forgetting
pathTypein YAML: When manually creating Ingress YAML fornetworking.k8s.io/v1,pathType(e.g.,Prefix,Exact) is a mandatory field. A common mistake is to omit it, which would cause validation errors. (Note:kubectl create ingresshandles this implicitly for simple rules like/).
Concept tested. The core concept being tested is the ability to create and configure Kubernetes Ingress resources to expose internal Services externally via HTTP/HTTPS routing. This includes understanding the Ingress object structure, specifying namespaces, defining routing rules (paths, backend services, and ports), and using kubectl commands for resource management within a Kubernetes cluster.
Topics
Community Discussion
No community discussion yet for this question.
