Bird
0
0

Given this NodePort service YAML, what port will you use to access the app externally?

medium📝 Command Output Q13 of 15
Kubernetes - Services
Given this NodePort service YAML, what port will you use to access the app externally?
apiVersion: v1
kind: Service
metadata:
  name: example-service
spec:
  type: NodePort
  selector:
    app: example
  ports:
    - port: 80
      targetPort: 8080
      nodePort: 31000
APort 31000 on the node IP
BPort 80 on the node IP
CPort 8080 on the node IP
DPort 80 on the pod IP
Step-by-Step Solution
Solution:
  1. Step 1: Understand NodePort port usage

    The nodePort field defines the port exposed on each node's IP for external access.
  2. Step 2: Identify the correct port from YAML

    The YAML sets nodePort: 31000, so external access uses port 31000 on any node IP.
  3. Final Answer:

    Port 31000 on the node IP -> Option A
  4. Quick Check:

    External access uses nodePort value = 31000 [OK]
Quick Trick: Use the nodePort value to access service externally [OK]
Common Mistakes:
  • Using targetPort or port instead of nodePort externally
  • Trying to access pod IP directly
  • Confusing port and nodePort fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes