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 10.43.15.106 <none> 8080/TCP 4h13m mysqlhost ClusterIP 10.43.53.186 <none> 3306/TCP 4h13m io-infra-agent-service ClusterIP 10.43.141.226 <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 10.42.0.179:8080,10.42.0.180:8080,10.42.1.119:8080 + 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 (10.43.124.208:8080) saving to 'index.html' index.html 100% |********************************| 11 0:00:00 ETA 'index.html' saved pod "busybox" deleted