Manual-scheduling
As we know that kubernetes scheduler is responsible for selecting which node that pod is going to be running on.
SoWhat if we need to restrict pod to be running on pod what we chose it [force pod to be running on specific pod] ?
We have parameter called nodeName used for manual scheduling pod on node.
This parameter used on yaml file before create pod.
nodeName is only used at yaml file before pod creation, k8s not let us use this parameter after pod creation other wise delete pod then recreate it again.
How to manual scheduling pod?
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
nodeName: node01
containers:
- image: nginx
name: nginx
Please note
! If you taint node with taint effect [noSchedule] and make the pod manual scheduled on this node it will be scheduled on this node.
What is pod is created and need to be manual scheduling on specific node ?
1) Create Bind Object
2) send post request [with bind object data in json format] to pod API.
vi bind1.yml
apiVersion: v1
kind: Binding
metadata:
name: node-binding
target:
- apiVersion: v1
kind: Node
name: node2 #node_name
This yaml file should be transformed on json then send as post request to pod api .