Bird
0
0

You have a LoadBalancer service exposing multiple ports. How can you ensure that traffic to port 443 is forwarded to targetPort 8443 in your pods?

hard📝 Workflow Q9 of 15
Kubernetes - Services
You have a LoadBalancer service exposing multiple ports. How can you ensure that traffic to port 443 is forwarded to targetPort 8443 in your pods?
AUse NodePort 443 and map to pod port 8443
BSet spec.externalIPs to 8443
CSpecify in the service YAML ports section: port: 443, targetPort: 8443
DConfigure pod containerPort to 443
Step-by-Step Solution
Solution:
  1. Step 1: Understand port mapping in LoadBalancer service

    Service port defines external port, targetPort defines pod port to forward traffic.
  2. Step 2: Correct YAML configuration

    Setting port: 443 and targetPort: 8443 forwards external 443 traffic to pod port 8443.
  3. Final Answer:

    Specify port 443 and targetPort 8443 in service YAML -> Option C
  4. Quick Check:

    Port to targetPort mapping done in service ports section [OK]
Quick Trick: Map external port to pod port using port and targetPort fields [OK]
Common Mistakes:
  • Misusing externalIPs for port mapping
  • Confusing NodePort with LoadBalancer port mapping
  • Changing containerPort without service port mapping

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes