Pods are in Pending state

3/23/2019

My pods are staying in Pending state, as all the answers mentioned I tried to get describe output but no idea about why it is staying in Pending state:

k8s@k8s-master:~/deployment$ kubectl get nodes
NAME         STATUS   ROLES    AGE   VERSION
k8s-master   Ready    master   12d   v1.12.2
k8s-node-1   Ready    <none>   12d   v1.12.2
k8s-node-2   Ready    <none>   12d   v1.12.2

k8s@k8s-master:~/deployment$ kubectl get pods           
NAME        READY   STATUS    RESTARTS   AGE
nginx       0/1     Pending   0          62m
webserver   0/1     Pending   0          13m


k8s@k8s-master:~/deployment$ kubectl describe pod webserver
Name:               webserver
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               <none>
Labels:             creator=rithin
Annotations:        <none>
Status:             Pending
IP:                 
Containers:
  apache:
    Image:        httpd
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-vdpls (ro)
Volumes:
  default-token-vdpls:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-vdpls
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:          <none>

Already tried describing the pods, but no info

-- Rithin Skaria
kubernetes

3 Answers

12/9/2019

Your pods require manual scheduling. In your yaml file for the pods add nodeName: k8s-master at the same level of containers under spec.

Your pods would be scheduled at the k8s-master node. If you want to schedule it in any other node, replace "k8s-master" with the appripriate node name.

-- subir
Source: StackOverflow

3/31/2019

Well I couldn't find any logs related to failure. So recreated the cluster and now it is working. I assume it was a problem with flannel.

-- Rithin Skaria
Source: StackOverflow

3/28/2019

One possiblity is that worker node is not reachable from master node as there is no node assigned to the pod.

-- shubham_asati
Source: StackOverflow