0
0
Kubernetesdevops~20 mins

Ingress resource definition in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Ingress Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of kubectl get ingress command
Given this Ingress YAML, what will be the output of kubectl get ingress my-ingress?
Kubernetes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /app
        pathType: Prefix
        backend:
          service:
            name: app-service
            port:
              number: 80
A
NAME         CLASS    HOSTS         ADDRESS   PORTS   AGE
my-ingress   <none>   example.com   <none>   80      1m
B
NAME         HOSTS         ADDRESS   PORTS   AGE
my-ingress   example.com             80      1m
C
NAME         CLASS    HOSTS         ADDRESS   PORTS   AGE
my-ingress   <none>   example.com             80      1m
D
NAME         CLASS    HOSTS         ADDRESS   PORTS   AGE
my-ingress   <none>   example.com             443     1m
Attempts:
2 left
💡 Hint
Look carefully at the columns shown by kubectl get ingress and the ports defined.
Configuration
intermediate
2:00remaining
Correct Ingress pathType usage
Which Ingress resource snippet correctly uses pathType to match all paths starting with /api?
A
paths:
- path: /api
  pathType: Prefix
  backend:
    service:
      name: api-service
      port:
        number: 8080
B
paths:
- path: /api*
  pathType: Prefix
  backend:
    service:
      name: api-service
      port:
        number: 8080
C
paths:
- path: /api/
  pathType: ImplementationSpecific
  backend:
    service:
      name: api-service
      port:
        number: 8080
D
paths:
- path: /api
  pathType: Exact
  backend:
    service:
      name: api-service
      port:
        number: 8080
Attempts:
2 left
💡 Hint
Prefix matches all paths starting with the given prefix exactly as written.
Troubleshoot
advanced
2:00remaining
Ingress not routing to service
You created this Ingress but requests to http://example.com/app return 404. What is the most likely cause?
Kubernetes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /app
        pathType: Exact
        backend:
          service:
            name: app-service
            port:
              number: 80
AThe service name app-service is incorrect and does not exist in the cluster.
BThe pathType Exact requires the request path to be exactly /app, but the request URL has a trailing slash or extra path segments.
CThe Ingress resource is missing the ingressClassName field.
DThe Ingress resource must specify the port name instead of port number.
Attempts:
2 left
💡 Hint
Check how pathType Exact matches request paths.
🧠 Conceptual
advanced
2:00remaining
Understanding Ingress TLS configuration
Which statement about TLS configuration in a Kubernetes Ingress resource is correct?
ATLS configuration in Ingress automatically redirects HTTP traffic to HTTPS.
BTLS configuration is optional and ignored if no hosts are specified in the TLS section.
CThe TLS secret must contain only the private key, the certificate is fetched automatically from the cluster.
DThe TLS section specifies the secret name containing the TLS certificate and the hosts it applies to.
Attempts:
2 left
💡 Hint
Think about what the TLS section defines and what it requires.
Best Practice
expert
2:00remaining
Best practice for Ingress resource annotations
Which annotation is recommended to enable automatic HTTPS redirect in NGINX Ingress Controller?
Anginx.ingress.kubernetes.io/ssl-redirect: "true"
Bnginx.ingress.kubernetes.io/force-ssl-redirect: "false"
Ckubernetes.io/ingress.class: "nginx"
Dnginx.ingress.kubernetes.io/use-regex: "true"
Attempts:
2 left
💡 Hint
Look for the annotation that controls SSL redirect behavior.