Bird
0
0

How can you configure Nginx Ingress to redirect HTTP traffic to HTTPS automatically?

hard📝 Application Q9 of 15
Kubernetes - Ingress
How can you configure Nginx Ingress to redirect HTTP traffic to HTTPS automatically?
AUse annotation 'kubernetes.io/ingress.class: "https"' in metadata
BSet 'spec.tls.enabled: true' in the Ingress spec
CConfigure service port to 443 instead of 80
DAdd annotation 'nginx.ingress.kubernetes.io/force-ssl-redirect: "true"' to the Ingress metadata
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct annotation for SSL redirect

    Nginx Ingress uses 'nginx.ingress.kubernetes.io/force-ssl-redirect: "true"' to enable HTTP to HTTPS redirect.
  2. Step 2: Eliminate incorrect options

    Setting tls.enabled is not valid, ingress.class "https" is wrong, and changing service port alone doesn't redirect.
  3. Final Answer:

    Add annotation 'nginx.ingress.kubernetes.io/force-ssl-redirect: "true"' to the Ingress metadata -> Option D
  4. Quick Check:

    Force SSL redirect annotation = Add annotation 'nginx.ingress.kubernetes.io/force-ssl-redirect: "true"' to the Ingress metadata [OK]
Quick Trick: Use Nginx annotation to force SSL redirect [OK]
Common Mistakes:
  • Confusing TLS config with redirect
  • Wrong ingress.class value
  • Changing service port without redirect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes