-
SSH to the master node.
-
Move the kube-scheduler manifest out of the
/etc/kubernetes/manifests/
folder.sudo mv /etc/kubernetes/manifests/kube-scheduler.manifest ~
-
Wait until the kubelet shuts down the scheduler pod. This can be checked by listing all system pods.
kubectl --namespace kube-system get pods
-
Deploy a pod normally.
-
Use the
get pods
command to list all pods. The one you've just deployed should be in a pending state with no node assigned to it. -
Use the
describe pod
command to check which node is assigned to the pod. -
Return the kube-scheduler manifest back to the
/etc/kubernetes/manifests/
folder on the master node.sudo mv ~/kube-scheduler.manifest /etc/kubernetes/manifests/
-
Wait until the scheduler runs and make sure that a node is now assigned to the pod and the pod is running.
- While the default scheduler is disabled and a pod in the Pending state, try to manually assign a node to the container using API.
- Use curl to sent a POST request to the
/api/v1/namespaces/{namespace}/bindings
endpoint. - The body of the request should have the following format
{"apiVersion":"v1", "kind": "Binding", "metadata": {"name": "<pod-name>"}, "target": {"apiVersion": "v1", "kind": "Node", "name": "<node-name>"}}
- Use the official Reference documentation and correct version of the API Reference to help.
curl -X POST 127.0.0.1:8080/api/v1/namespaces/default/bindings -H "Content-Type:application/json" -d '{"apiVersion":"v1", "kind": "Binding", "metadata": {"name": "twocontainers"}, "target": {"apiVersion": "v1", "kind": "Node", "name": "master-us-west1-c-4lmf"}}'
- Make sure you copy/move the kube-scheduler manifest back into
/etc/kubernetes/manifests/
- Use curl to sent a POST request to the