CKA CKA Services and Ingress 2 — Questions and Answers
Question 1: What is the primary purpose of an Ingress resource in Kubernetes?
- To expose services externally via TCP/UDP port forwarding
- To manage HTTP/HTTPS routing from outside the cluster to internal services (Correct answer)
- To load balance traffic between cluster nodes
- To create internal cluster DNS records
Correct answer: To manage HTTP/HTTPS routing from outside the cluster to internal services
An Ingress resource defines HTTP/HTTPS routing rules, enabling external traffic to reach internal services with host/path-based routing and TLS termination.
Question 2: What must be deployed in a cluster before Ingress resources can route traffic?
- kube-proxy
- CoreDNS
- An Ingress Controller (Correct answer)
- MetalLB
Correct answer: An Ingress Controller
An Ingress Controller (such as ingress-nginx or Traefik) must be running to implement and enforce the rules defined in Ingress resources.
Question 3: Which Ingress spec field specifies which Ingress controller should handle a given Ingress resource?
- spec.controller
- spec.ingressClassName (Correct answer)
- spec.class.name
- metadata.ingress.class
Correct answer: spec.ingressClassName
The `spec.ingressClassName` field references an IngressClass object that maps to a specific Ingress controller.
Question 4: How is TLS termination configured in an Ingress resource?
- Add a tls section referencing a Secret with the certificate and key (Correct answer)
- Set spec.tls: true at the top level
- Create a separate TLSPolicy resource
- Annotate the backend Service with tls: enabled
Correct answer: Add a tls section referencing a Secret with the certificate and key
TLS is configured via the `spec.tls` array in the Ingress, referencing a Kubernetes Secret that contains the TLS certificate and private key.
Question 5: Which Ingress `pathType` value matches only the exact URL path with no prefix tolerance?
- Prefix
- Exact (Correct answer)
- ImplementationSpecific
- Strict
Correct answer: Exact
The `Exact` pathType matches only requests whose URL path is identical to the specified path, with no trailing slash tolerance.
Question 6: Which Ingress pathType routes all URLs that begin with the specified path?
- Exact
- Prefix (Correct answer)
- ImplementationSpecific
- Wildcard
Correct answer: Prefix
The `Prefix` pathType matches any URL path that starts with the specified prefix, enabling routing for an entire path subtree.
What is the primary purpose of an Ingress resource in Kubernetes?