Is there a way to apply a nodeSelector via command? (like kubectl apply
)
It would be nice if it is applicable on running deployments or namespaces, otherwise applying to running pods is also fine.
Any tips are appreciated
Is there a way to apply a nodeSelector via command? (like kubectl apply
)
It would be nice if it is applicable on running deployments or namespaces, otherwise applying to running pods is also fine.
Any tips are appreciated
You can use the kubectl patch command, like this:
kubectl patch deployments nginx-deployment -p '{"spec": {"template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "node-2"}}}}}'
After successful patch all pods of the deployment will be restarted on a node matching the selector.