Kubernetes Container Orchestration Networking Services 4 — Questions and Answers
Question 1: What is the primary role of the Kubernetes Ingress resource?
- Assign static IPs to pods
- Expose HTTP/HTTPS routes from outside the cluster to Services (Correct answer)
- Provide pod-to-pod encryption
- Define egress traffic rules
Correct answer: Expose HTTP/HTTPS routes from outside the cluster to Services
An Ingress resource defines rules that route external HTTP and HTTPS traffic to internal cluster Services based on host names and URL paths.
Question 2: What component actually processes Ingress rules and routes traffic accordingly?
- kube-proxy
- kubelet
- Ingress Controller (Correct answer)
- CoreDNS
Correct answer: Ingress Controller
An Ingress Controller (e.g., nginx-ingress or Traefik) is a pod that watches Ingress resources and configures the underlying proxy to fulfill the routing rules.
Question 3: In an Ingress spec, which field allows you to route traffic to different Services based on the URL path?
- host
- rules.http.paths (Correct answer)
- tls
- backend.service
Correct answer: rules.http.paths
The rules[].http.paths array lets you map specific URL paths (e.g., /api, /static) to different backend Services within a single Ingress resource.
Question 4: How do you configure TLS termination for an Ingress resource?
- Set spec.tls with a secretName referencing a TLS Secret (Correct answer)
- Add a tls: true annotation
- Create a separate TLSIngress resource
- Configure it in the Service's spec
Correct answer: Set spec.tls with a secretName referencing a TLS Secret
The spec.tls field references a Kubernetes Secret of type kubernetes.io/tls containing the certificate and key, enabling TLS termination at the Ingress.
Question 5: What happens when an Ingress resource has no matching rule for an incoming request?
- The request is retried
- The request is routed to the defaultBackend (Correct answer)
- kube-proxy intercepts the request
- The request is dropped silently
Correct answer: The request is routed to the defaultBackend
Unmatched requests fall through to the defaultBackend defined in the Ingress (or the controller's global default), which typically returns a 404 response.
Question 6: Which Ingress path type ensures that only exact URL matches trigger the routing rule?
- Prefix
- ImplementationSpecific
- Exact (Correct answer)
- Wildcard
Correct answer: Exact
pathType: Exact routes traffic only when the request path matches the specified path character-for-character with no prefix matching.
Question 7: Which annotation is commonly used to specify which Ingress Controller class should handle a particular Ingress resource (pre-1.18 style)?
- kubernetes.io/ingress.class (Correct answer)
- ingress.kubernetes.io/controller
- networking.k8s.io/class
- kubernetes.io/controller-name
Correct answer: kubernetes.io/ingress.class
The kubernetes.io/ingress.class annotation was the original way to assign an Ingress to a specific controller; from 1.18+ the spec.ingressClassName field is preferred.
What is the primary role of the Kubernetes Ingress resource?