An Ingress resource manages external access to services inside a Kubernetes cluster, usually HTTP. It defines rules to route traffic from outside to services inside the cluster.
Click to reveal answer
beginner
Which Kubernetes object does an Ingress resource route traffic to?
Ingress routes traffic to Kubernetes Services, which then forward traffic to Pods.
Click to reveal answer
intermediate
What is the purpose of the 'host' field in an Ingress rule?
The 'host' field specifies the domain name to match for routing traffic. It helps direct requests to the correct backend service based on the requested hostname.
Click to reveal answer
intermediate
Explain the 'path' and 'pathType' fields in an Ingress rule.
'path' defines the URL path to match for routing. 'pathType' specifies how the path is matched, such as 'Prefix' (matches path prefix) or 'Exact' (matches exact path).
Click to reveal answer
beginner
What is the role of an Ingress controller in Kubernetes?
An Ingress controller watches Ingress resources and configures the underlying load balancer or proxy to route traffic according to the Ingress rules.
Click to reveal answer
What does an Ingress resource primarily manage in Kubernetes?
AContainer image building
BExternal HTTP/S traffic routing to services
CStorage volume allocation
DPod scheduling inside nodes
✗ Incorrect
Ingress resources manage external HTTP/S traffic routing to services inside the cluster.
Which field in an Ingress rule specifies the domain name to match?
Abackend
BserviceName
Cpath
Dhost
✗ Incorrect
The 'host' field specifies the domain name to match for routing traffic.
What does the 'pathType' field in an Ingress rule define?
AHow the URL path is matched
BThe protocol used
CThe type of backend service
DThe port number
✗ Incorrect
'pathType' defines how the URL path is matched, such as 'Prefix' or 'Exact'.
An Ingress controller is responsible for:
AWatching Ingress resources and configuring routing
BManaging persistent volumes
CCreating Pods
DBuilding container images
✗ Incorrect
Ingress controllers watch Ingress resources and configure routing accordingly.
Which Kubernetes object does Ingress route traffic to?
ANodes
BPods directly
CServices
DConfigMaps
✗ Incorrect
Ingress routes traffic to Services, which then forward to Pods.
Describe the main components of a Kubernetes Ingress resource and their roles.
Think about how traffic is matched and routed.
You got /4 concepts.
Explain how an Ingress resource and an Ingress controller work together to route external traffic.
Consider the division of responsibilities.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a Kubernetes Ingress resource?
easy
A. To route external HTTP(S) traffic to internal services based on rules
B. To store configuration data for pods
C. To manage persistent storage volumes
D. To schedule pods on specific nodes
Solution
Step 1: Understand Ingress role
An Ingress resource defines rules to route external traffic to services inside the cluster.
Step 2: Compare with other resources
ConfigMaps store config, PersistentVolumes manage storage, and scheduling is done by the scheduler, not Ingress.
Final Answer:
To route external HTTP(S) traffic to internal services based on rules -> Option A
Quick Check:
Ingress routes external traffic [OK]
Hint: Ingress routes external traffic to services inside Kubernetes [OK]
Common Mistakes:
Confusing Ingress with ConfigMap or PersistentVolume
Thinking Ingress schedules pods
Assuming Ingress manages storage
2. Which of the following is the correct minimal YAML snippet to define an Ingress that routes /app path to a service named my-service on port 80?
Correct apiVersion for Ingress is networking.k8s.io/v1 and kind is Ingress.
Step 2: Validate backend service and port
apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n name: example-ingress\nspec:\n rules:\n - http:\n paths:\n - path: /app\n pathType: Prefix\n backend:\n service:\n name: my-service\n port:\n number: 80 uses correct new syntax with service name and port number 80 matching the question.
Final Answer:
YAML with apiVersion networking.k8s.io/v1, kind Ingress, path /app, service my-service, port 80 -> Option B
Quick Check:
Correct Ingress YAML uses networking.k8s.io/v1 and service port number [OK]
Hint: Use networking.k8s.io/v1 and service.port.number for Ingress backend [OK]
Common Mistakes:
Using old apiVersion v1 for Ingress
Using serviceName/servicePort instead of service.name/port.number
Wrong port number in backend
Defining Service instead of Ingress
3. Given this Ingress YAML snippet, what host and path will route traffic to web-service?
C. Using deprecated backend syntax serviceName and servicePort instead of service.name and service.port.number
D. Missing metadata name field
Solution
Step 1: Check backend syntax in Ingress spec
The YAML uses old syntax with serviceName and servicePort which is deprecated in networking.k8s.io/v1.
Step 2: Confirm correct syntax
Correct syntax uses service.name and service.port.number fields under backend.service.
Final Answer:
Using deprecated backend syntax serviceName and servicePort instead of service.name and service.port.number -> Option C
Quick Check:
Use service.name and service.port.number in Ingress backend [OK]
Hint: Use service.name and service.port.number for backend in networking.k8s.io/v1 [OK]
Common Mistakes:
Using old backend syntax causing Ingress controller to ignore rules
Assuming missing host always breaks routing
Confusing apiVersion correctness
Forgetting metadata name
5. You want to expose two services, service-a and service-b, on the same IP but different paths /a and /b. Which Ingress YAML snippet correctly defines this?