What is the primary purpose of a NodePort service in Kubernetes?
Think about how external users can reach a service running inside Kubernetes nodes.
A NodePort service opens a specific port on every node in the cluster. This port forwards traffic to the service, allowing external access through any node's IP and that port.
What is the default port range for NodePort services in Kubernetes?
NodePort ports are usually in a high range to avoid conflicts with well-known ports.
Kubernetes reserves ports 30000 to 32767 for NodePort services by default to avoid conflicts with system ports.
Which YAML snippet correctly defines a NodePort service exposing port 8080 on target pods?
Check that the service type is NodePort and ports match the target pod port.
Option A correctly sets the service type to NodePort, exposes port 8080, and maps nodePort 30080 to targetPort 8080 on pods.
You created a NodePort service on port 30080, but external clients cannot access it. Which is the most likely cause?
Think about network rules outside Kubernetes that might block traffic.
Even if Kubernetes exposes the port, external firewalls on nodes can block incoming traffic, preventing access.
Which practice is recommended when using NodePort services in a production Kubernetes environment?
Consider security and scalability for production environments.
NodePort is simple but less secure and scalable. LoadBalancer or Ingress controllers provide better production-grade traffic management.