Skip to main content

Quiz Module 8 - Ingress and Load Balancing

Instructions

This quiz contains 30 multiple-choice questions.


Question 1

What is Ingress in Kubernetes?

View explanation

Correct answer: A resource that exposes HTTP/HTTPS Services from outside the cluster

Explanation: Ingress enables HTTP/HTTPS routing based on the path or hostname, with TLS/SSL support.


Question 2

What is an Ingress Controller?

View explanation

Correct answer: A Pod that watches Ingress resources and configures a load balancer to expose them

Explanation: An Ingress Controller (such as NGINX Ingress, Traefik) watches Ingress resources and configures a reverse proxy/load balancer to expose Services.


Question 3

What is the most popular Ingress Controller?

View 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?

View 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 do you configure TLS/SSL for an Ingress?

View 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?

View explanation

Correct answer: A Kubernetes operator that automatically manages TLS/SSL certificates

Explanation: cert-manager obtains, renews, and automatically manages TLS certificates from Let's Encrypt or other certificate authorities.


Question 7

What is the difference between an Ingress and a LoadBalancer Service?

View explanation

Correct answer: Ingress enables 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?

View 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?

View 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?

View 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?

View 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 exposure of multiple Services via a single entry point.


Question 12

What is the command to install NGINX Ingress Controller?

View 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?

View explanation

Correct answer: An Ingress that rewrites the URL path before forwarding 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 NodePort Service for exposing an application?

View explanation

Correct answer: Ingress offers HTTP/HTTPS routing and TLS, NodePort exposes directly on a port

Explanation: Ingress enables 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?

View 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 (for example: /api matches /api/v1/users).


Question 16

What is the command to view the Ingress Controller Pods?

View explanation

Correct answer: kubectl get pods -n ingress-nginx (or the namespace where the Ingress Controller is installed)

Explanation: Ingress Controllers generally run in a dedicated namespace (such as ingress-nginx). Use -n to specify the namespace.


Question 17

What is an Ingress with multiple hostnames?

View explanation

Correct answer: An Ingress that can route to different Services based on the request hostname

Explanation: An Ingress can have multiple rules with different hostnames, allowing routing to different Services based on the request domain (e.g., app1.example.com, app2.example.com).


Question 18

What is the best practice for exposing multiple applications via Ingress?

View 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 exposure of multiple Services via a single entry point.


Question 19

What is an Ingress with the ssl-redirect annotation?

View explanation

Correct answer: An Ingress that automatically redirects HTTP traffic to HTTPS

Explanation: The annotation nginx.ingress.kubernetes.io/ssl-redirect: "true" forces redirection from HTTP to HTTPS to improve security.


Question 20

What is the difference between an Ingress and a Service Mesh?

View 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 a backend service?

View 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?

View 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?

View 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?

View explanation

Correct answer: Use cert-manager for automatic certificate management with Let's Encrypt

Explanation: cert-manager automates the obtaining, renewal, and management of TLS certificates, eliminating manual work and ensuring valid certificates.


Question 25

What is an Ingress with CORS (Cross-Origin Resource Sharing)?

View 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?

View 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) offers advanced features such as rate limiting, authentication, request transformation, etc.


Question 27

What is an Ingress with rate limiting?

View 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 Ingress Controller logs?

View explanation

Correct answer: kubectl logs -n ingress-nginx [ingress-controller-pod-name]

Explanation: The Ingress Controller logs are in the Ingress Controller Pods. Use kubectl logs with the namespace and Pod name.


Question 29

What is an Ingress with session affinity?

View 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?

View 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: December 2024