Kubernetes pod not starting

2/2/2017

I have a kubernetes cluster with 5 nodes. When I add a simple nginx pod it will be scheduled to one of the nodes but it will not start up. It will not even pull the image.

This is the nginx.yaml file:

apiVersion: v1
kind: Pod 
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80

when I describe the pod there is one event: Successfully assigned busybox to up02 When I log in to the up02 and check to see if there are any images pulled I see it didn't get pulled so I pulled it manually (I thought maybe it needs some kick start ;) )

The pod will allways stay in the Container creating state. It's not only with this pod, the problem is with any pod I try to add.

There are some pods running on the machine which is necessary for Kubernetes to operate:

up@up01:~$ kubectl get pods --all-namespaces
NAMESPACE     NAME                                    READY     STATUS              RESTARTS   AGE
default       busybox                                 0/1       ContainerCreating   0          11m
default       nginx                                   0/1       ContainerCreating   0          22m
kube-system   dummy-2088944543-n1cd5                  1/1       Running             0          5d
kube-system   etcd-up01                               1/1       Running             0          5d
kube-system   kube-apiserver-up01                     1/1       Running             0          5d
kube-system   kube-controller-manager-up01            1/1       Running             0          5d
kube-system   kube-discovery-1769846148-xfpls         1/1       Running             0          5d
kube-system   kube-dns-2924299975-5rzz8               4/4       Running             0          5d
kube-system   kube-proxy-17bpl                        1/1       Running             2          3d
kube-system   kube-proxy-3pk63                        1/1       Running             0          3d
kube-system   kube-proxy-h3wrj                        1/1       Running             0          5d
kube-system   kube-proxy-wzqv4                        1/1       Running             0          3d
kube-system   kube-proxy-z3xxx                        1/1       Running             0          3d
kube-system   kube-scheduler-up01                     1/1       Running             0          5d
kube-system   kubernetes-dashboard-3203831700-3xfbd   1/1       Running             0          5d
kube-system   weave-net-6c0nr                         2/2       Running             0          3d
kube-system   weave-net-dchhf                         2/2       Running             0          5d
kube-system   weave-net-hshvg                         2/2       Running             4          3d
kube-system   weave-net-n684c                         2/2       Running             1          3d
kube-system   weave-net-r5319                         2/2       Running             0          3d
-- Ravenix
kubectl
kubelet
kubernetes

3 Answers

2/2/2017

You can do

kubectl describe pods <pod>

to get more info on what's happening.

-- manojlds
Source: StackOverflow

2/3/2017

Can you recreate the nginx pod again in namespace kube-system?

kubectl create --namespace kube-system -f nginx.yaml

this should fix your problem.

Second, do you have proxy in your environment, take a look as well.

-- BMW
Source: StackOverflow

10/22/2018

make sure that your namespace and service account information is correct. if you've configured your services or deployments to use a namespace or service account, that namespace needs to exist.

If you configured it to use a non - default service account then that has to exist as well, and the service account should be created after the namespace.

you shouldn't be necessarily using the kube system namespace. namespaces exist so there can be more than one of them and control the flow of traffic inside of a cluster.

you should also set potentially set permissions for your namespace. read this here. https://kubernetes.io/docs/reference/access-authn-authz/rbac/#service-account-permissions

-- David Hunsicker
Source: StackOverflow