A developer created a Deployment with 3 replicas and a ClusterIP Service named 'app-service' on port 80 targeting port 8080 on the pods. Pod logs show that the container is listening on 8080, but curl from another pod in the same namespace to http://app-service:80 fails with 'Connection refused'. What is the most likely cause?
Trap 1: The container port is 8080 but the Service targetPort is 80.
The Service targetPort is 8080, which matches the container port.
Trap 2: The Service type should be NodePort for inter-pod communication.
ClusterIP is sufficient for inter-pod communication within the cluster.
Trap 3: The DNS resolution for 'app-service' is failing.
DNS resolution would result in a different error (name resolution failure).
- A
The Service selector does not match the pod labels.
If labels don't match, the Service has no endpoints, causing connection refused.
- B
The container port is 8080 but the Service targetPort is 80.
Why wrong: The Service targetPort is 8080, which matches the container port.
- C
The Service type should be NodePort for inter-pod communication.
Why wrong: ClusterIP is sufficient for inter-pod communication within the cluster.
- D
The DNS resolution for 'app-service' is failing.
Why wrong: DNS resolution would result in a different error (name resolution failure).