Contents

Kubernetes No Scheduler

You must know!

Note
I think you’d better keep running scheduler.

No Scheduler!

What happened?
When the scheduler is not running and the nodeName is undefined when the POD is created, the POD’s status is in Pending.

How to change does the status Pending to Running

No Scheduler Simulation

POD YAML

pod-definition.yml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    name: nginx
spec:
  containers:
    - name: nginx
      image: nginx
      ports:
        - containerPort: 8080

Create a POD

1
kubectl apply -f pod-definition.yml

Check Status

1
kubectl get pods
1
2
NAME    READY   STATUS      RESTARTS    AGE
nginx   0/1     Pending     0           3s

Oops!! It’s Pending status!!

How to fix it!

POD YAML with nodeName

pod-nodename-definition.yml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    name: nginx
spec:
  containers:
    - name: nginx
      image: nginx
      ports:
        - containerPort: 8080
  nodeName: node02 # -> You have to set this value when you need to change the status Pending to Running.

Create a POD

1
kubectl apply -f pod-nodename-definition.yml

Check Status

1
kubectl get pods
1
2
NAME    READY   STATUS      RESTARTS    AGE     IP          NODE
nginx   1/1     Running     0           9s      10.40.0.4   node02

Wow, it’s Running now!