kubernetes service isn't starting

1/23/2019

I'm trying to start a service I added to kubernetes and I'm not sure why it isn't starting. I'm able to add it with

d2 swarm service add 'testservice/daemonset.yaml'

then when I start it I see

d2 swarm service add 'testservice/daemonset.yaml'
creating service

and now when I ssh into the swarm and do

kubectl get ds -n testing

It shows up as a service but not as started

Is there any other logs or debug services commands I can use? Thanks

-- John2
json
kubernetes
linux
yaml

1 Answer

1/23/2019

get ds gives you current status of the DaemonSet, but to see why its Pods (or rather, container(s) in these pods) aren't running you'll have to describe the pods, not the DaemonSet.

  1. Run kubectl get pods -n testing to get a list of pods. Since this is a DaemonSet, there should be one pod per worker node. The STATUS column tells you which state the pod is currently in. Ideally it should say Running.
  2. If STATUS is not Running, grab the pod NAME and run kubectl describe pod <pod_name> -n testing. Look for the Events section towards the bottom; It normally tells you what's wrong with your pod.
  3. If the log says it's trying to restart a failed container, that means the service itself is most likely crashing. You can check the logs from the service by running kubectl logs <pod_name> -n testing.

This is typically enough to troubleshoot service-related issues preventing pods from starting up. If you still cannot figure out what the problem is, please update your question with output from each of these steps (after omitting personal/sensitive information, of course) so we can help you further.

-- PoweredByOrange
Source: StackOverflow