Run a pod without scheduler in Kubernetes

9/24/2017

I searched the documentation but I am unable to find out if I can run a pod in Kubernetes without Scheduler. If anyone can help with any pointers it would be helpful

Update: I can attach a label to node and let pod stick to that label but that would involve going through the scheduler. Is there any method without daemonset and does not use scheduler.

-- Mehul
kubernetes

3 Answers

2/5/2020

You can simply add a nodeName attribute to the pod definition which by they normally field out by the scheduler therefor it's not a mandatory field.

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  -  image: nginx
     name: nginx
  nodeName: node01

if the pod has been created and in pending state you have to recreate it with the new field, edit is not permitted with the nodeName att.

-- User_KA
Source: StackOverflow

9/24/2017

The scheduler just sets the spec.nodeName field on the pod. You can set that to a node name yourself if you know which node you want to run your pod, though you are then responsible for ensuring the node has sufficient resources to run the pod (enough memory, free host ports, etc… all things the scheduler is normally responsible for checking before it assigns a pod to a node)

-- Jordan Liggitt
Source: StackOverflow

9/24/2017

You want static pods

Static pods are managed directly by kubelet daemon on a specific node, without API server observing it. It does not have associated any replication controller, kubelet daemon itself watches it and restarts it when it crashes.

-- Janos Lenart
Source: StackOverflow