Openshift - Pod associated with a service shows "x" against Receiving Traffic Option

4/9/2020

I noticed that in the Pod associated with a service shows "x" against Receiving Traffic Option.

The tooltip text for the "x" image says "The pod has no endpoints and is not accepting traffic".

And yes when i hit the service endpoint i get a HTTP 502 back.

Could you please tell whats wrong with the POD.

Here is my service description:

Namespace:         mynamespace
Labels:            app=myapp
Selector:          app.kubernetes.io/instance=myapp-instance
Type:              ClusterIP
IP:                xx.xx.xxx.xxx
Port:              80-http  80/TCP
TargetPort:        http/TCP
Endpoints:
Session Affinity:  None
Events:            <none>

and in my pod i see the label: app.kubernetes.io/instance=myapp-instance

-- lr-pal
kubernetes
kubernetes-helm
openshift
redhat

1 Answer

4/9/2020

Describing the service should show endpoints as empty in this case which explains the error.

kubectl describe svc servicename

You should check that the spec.selector field of your Service actually selects for metadata.labels values on your Pods. A common mistake is to have a typo or other error, such as the Service selecting for app=hostnames, but the Deployment specifying run=hostnames.

https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/#does-the-service-have-any-endpoints

-- Arghya Sadhu
Source: StackOverflow