Quiz Module 8 - Ingress and Load Balancing
Instructions
This quiz contains 30 multiple-choice questions.
Question 1
What is Ingress in Kubernetes?
See explanation
Correct answer: A resource that exposes HTTP/HTTPS Services from outside the cluster
Explanation: Ingress allows HTTP/HTTPS routing based on path or hostname, with TLS/SSL support.
Question 2
What is an Ingress Controller?
See explanation
Correct answer: A Pod that monitors Ingress resources and configures a load balancer to expose them
Explanation: An Ingress Controller (like NGINX Ingress, Traefik) monitors Ingress resources and configures a reverse proxy/load balancer to expose Services.
Question 3
What is the most popular Ingress Controller?
See explanation
Correct answer: NGINX Ingress Controller
Explanation: NGINX Ingress Controller is the most popular and widely used, maintained by the Kubernetes community and NGINX.
Question 4
What is ingressClassName in an Ingress resource?
See explanation
Correct answer: The Ingress class that specifies which Ingress Controller should manage this resource
Explanation: ingressClassName allows specifying which Ingress Controller should manage this Ingress resource, useful when multiple Ingress Controllers are installed.
Question 5
How to configure TLS/SSL for an Ingress?
See explanation
Correct answer: Via the tls section with a Secret containing the certificate and private key
Explanation: The tls section in an Ingress references a Secret of type kubernetes.io/tls containing tls.crt (certificate) and tls.key (private key).
Question 6
What is cert-manager?
See explanation
Correct answer: A Kubernetes operator that automatically manages TLS/SSL certificates
Explanation: cert-manager automatically obtains, renews, and manages TLS certificates from Let's Encrypt or other certificate authorities.
Question 7
What is the difference between an Ingress and a Service LoadBalancer?
See explanation
Correct answer: Ingress allows HTTP/HTTPS routing based on path/hostname, LoadBalancer exposes a Service directly
Explanation: Ingress offers advanced routing (multiple Services via a single entry point), while LoadBalancer exposes a single Service directly.
Question 8
What is a pathType in an Ingress rule?
See explanation
Correct answer: How the path is interpreted: Exact, Prefix, or ImplementationSpecific
Explanation: pathType determines how the path is matched: Exact (exact match), Prefix (prefix match), or ImplementationSpecific (depends on the implementation).
Question 9
What is the command to view Ingresses?
See explanation
Correct answer: kubectl get ingress
Explanation: kubectl get ingress (or ing) displays all Ingresses and their status, including assigned IP addresses.
Question 10
What is an annotation in an Ingress?
See explanation
Correct answer: Metadata that configures the behavior of the Ingress Controller
Explanation: Annotations allow configuring specific features of the Ingress Controller (rewrite rules, SSL redirect, etc.).
Question 11
What is an Ingress with multiple rules?
See explanation
Correct answer: An Ingress that can route to multiple Services based on different hostnames or paths
Explanation: An Ingress can have multiple rules, each defining different routing based on hostname or path, allowing multiple Services to be exposed via a single entry point.
Question 12
What is the command to install NGINX Ingress Controller?
See explanation
Correct answer: kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
Explanation: NGINX Ingress Controller can be installed via kubectl apply with the official manifest, or via Helm.
Question 13
What is an Ingress with rewrite-target?
See explanation
Correct answer: An Ingress that rewrites the URL path before passing it to the backend Service
Explanation: The annotation nginx.ingress.kubernetes.io/rewrite-target allows modifying the URL path, useful when the backend Service expects a different path.
Question 14
What is the difference between an Ingress and a Service NodePort for exposing an application?
See explanation
Correct answer: Ingress offers HTTP/HTTPS and TLS routing, NodePort exposes directly on a port
Explanation: Ingress allows path/hostname-based routing with TLS support, while NodePort simply exposes a Service on a static port.
Question 15
What is an Ingress with pathType: Prefix?
See explanation
Correct answer: An Ingress where the path matches if the URL starts with the specified prefix
Explanation: pathType: Prefix means the path matches if the URL starts with the prefix (e.g., /api matches /api/v1/users).
Question 16
What is the command to view the Pods of the Ingress Controller?
See explanation
Correct answer: kubectl get pods -n ingress-nginx (or the namespace where the Ingress Controller is installed)
Explanation: Ingress Controllers usually run in a dedicated namespace (like ingress-nginx). Use -n to specify the namespace.
Question 17
What is an Ingress with multiple hostnames?
See explanation
Correct answer: An Ingress that can route to different Services based on the request's hostname
Explanation: An Ingress can have multiple rules with different hostnames, allowing routing to different Services based on the request's domain (e.g., app1.example.com, app2.example.com).
Question 18
What is the best practice for exposing multiple applications via Ingress?
See explanation
Correct answer: Use an Ingress with multiple rules based on hostname or path
Explanation: A single Ingress with multiple rules is more efficient and easier to manage than multiple Ingresses, allowing multiple Services to be exposed via a single entry point.
Question 19
What is an Ingress with ssl-redirect annotation?
See explanation
Correct answer: An Ingress that automatically redirects HTTP traffic to HTTPS
Explanation: The annotation nginx.ingress.kubernetes.io/ssl-redirect: "true" forces HTTP to HTTPS redirection to enhance security.
Question 20
What is the difference between an Ingress and a Service Mesh?
See explanation
Correct answer: Ingress manages incoming HTTP/HTTPS traffic, Service Mesh manages inter-service communication with observability and security
Explanation: Ingress is for external incoming traffic, while a Service Mesh (like Istio) manages communication between microservices with mTLS, observability, and traffic control.
Question 21
What is an Ingress with backend service?
See explanation
Correct answer: An Ingress that routes traffic to a specified Kubernetes Service
Explanation: Each rule in an Ingress specifies a backend service that receives traffic matching the rule's hostname/path.
Question 22
What is the command to test an Ingress locally?
See explanation
Correct answer: curl -H "Host: [hostname]" http://[ingress-ip] or use port-forward to the Ingress Controller
Explanation: To test an Ingress, use curl with the Host header to specify the hostname, or use kubectl port-forward to access the Ingress Controller locally.
Question 23
What is an Ingress with defaultBackend?
See explanation
Correct answer: An Ingress that specifies a default Service for requests that do not match any rule
Explanation: defaultBackend allows defining a Service that receives traffic not matching any rule, useful for a custom 404 page.
Question 24
What is the best practice for managing TLS certificates with Ingress?
See explanation
Correct answer: Use cert-manager for automatic certificate management with Let's Encrypt
Explanation: cert-manager automates obtaining, renewing, and managing TLS certificates, eliminating manual work and ensuring valid certificates.
Question 25
What is an Ingress with CORS (Cross-Origin Resource Sharing)?
See explanation
Correct answer: An Ingress configured with annotations to allow cross-origin requests
Explanation: CORS annotations (like nginx.ingress.kubernetes.io/enable-cors) allow configuring CORS headers to permit requests from different domains.
Question 26
What is the difference between an Ingress and an API Gateway?
See explanation
Correct answer: Ingress is for basic HTTP/HTTPS routing, API Gateway offers advanced features (rate limiting, authentication, transformation)
Explanation: Ingress offers basic routing, while an API Gateway (like Kong, Ambassador) provides advanced features like rate limiting, authentication, request transformation, etc.
Question 27
What is an Ingress with rate limiting?
See explanation
Correct answer: An Ingress configured with annotations to limit the number of requests per client
Explanation: Rate limiting annotations (like nginx.ingress.kubernetes.io/limit-rps) allow limiting the number of requests per second to protect backends.
Question 28
What is the command to view the logs of the Ingress Controller?
See explanation
Correct answer: kubectl logs -n ingress-nginx [ingress-controller-pod-name]
Explanation: The logs of the Ingress Controller are in the Ingress Controller Pods. Use kubectl logs with the namespace and Pod name.
Question 29
What is an Ingress with session affinity?
See explanation
Correct answer: An Ingress configured to direct requests from the same client to the same backend Pod
Explanation: Session affinity (sticky sessions) ensures that requests from the same client always go to the same backend Pod, useful for application sessions.
Question 30
What is the best practice for exposing an application in production with Ingress?
See explanation
Correct answer: Use HTTPS with cert-manager, configure ssl-redirect, and use annotations for security
Explanation: In production, always use HTTPS with cert-manager for automatic certificates, enable ssl-redirect, and configure appropriate security annotations.
Quiz Result
Congratulations on completing the Module 8 quiz!
Score:
- 25-30 correct answers: Excellent! You master Ingress and Load Balancing.
- 20-24 correct answers: Very good! Review the concepts where you had difficulties.
- 15-19 correct answers: Good! Review the chapters on Ingress and Ingress Controllers.
- Less than 15: Recommended to review the module before continuing.
Quiz created on: December 2024