Debug Kubernetes Service with Busybox Pod

Written by Israel Ogbole on

A problem that occurs quite often with new Kubernetes Deployments is that a Service is not working correctly.

You have created a pod via a deployment (or other k8s workload types) and created a service, but the service is not responding.  Try the following steps to troubleshoot it. 

First, ensure that your Pod is up and running, then check the status of the service:

First, ensure that your Pod is up and running, then check the status of the Service:

$ kubectl get svc 
NAME                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
client-api                 ClusterIP    <none>        8080/TCP   4h13m
mysqlhost                  ClusterIP    <none>        3306/TCP   4h13m
io-infra-agent-service     ClusterIP   <none>        9090/TCP   35m

Assuming I am interested in the client-api service, check if the Service has endpoints:

kubectl get ep client-api 
NAME         ENDPOINTS                                                        AGE
client-api,, + 1 more...   4h18m

The above result confirms that the endpoints controller has found the correct Pods for the client-api Service. If the ENDPOINTS column is <none>, you should check that the spec.selector field of your Service selects for metadata.labels values on your Pods.

At this point, you may want to spin a new (busybee) pod to verify connectivity once more. This step should isolate if the problem is with the calling pod.

$ kubectl run busybox --image=busybox -it --rm --restart=Never -- wget client-api:8080
Connecting to client-api:8080 (
saving to 'index.html'
index.html           100% |********************************|    11  0:00:00 ETA
'index.html' saved
pod "busybox" deleted

About Israel GirlDad, Engineering Product Manager, Solutions Architect, Software Consultant, MBA candidate, and now an occasional blogger


comments powered by Disqus