I have a command kubectl run -it my-pod --image=<my-image> /bin/sh and I'd like the pod to be scheduled on a specific node.
Is that possible and, if so, how?
I have a command kubectl run -it my-pod --image=<my-image> /bin/sh and I'd like the pod to be scheduled on a specific node.
Is that possible and, if so, how?
Get the hostname:
kubectl get nodes
Schedule pod on a specific node:
kubectl run mypod --image ubuntu:18.04 --overrides='{"apiVersion": "v1", "spec": {"nodeSelector": { "kubernetes.io/hostname": "my-node.internal" }}}' --command -- sleep 100000000000000
or
kubectl run mypod --image ubuntu:18.04 --overrides='{"apiVersion": "apps/v1", "spec": {"nodeSelector": { "kubernetes.io/hostname": "my-node.internal" }}}' --command -- sleep 100000000000000
You may need to change apiVersion value, please find one:
kubectl api-versions