Home > Mobile >  Kubernetes apply nodeSelector via command
Kubernetes apply nodeSelector via command

Time:03-20

Is there a way to apply a nodeSelector via command? (like kubectl apply)

It would be nice if it is applicable on deployments or namespaces, otherwise applying to pods is also fine.

Any tips are appreciated

CodePudding user response:

You can use command kubectl edit to add nodeSelector to yaml file or use command:

kubectl run -ti --rm test --image=ubuntu:18.04 --overrides='{"spec": { "nodeSelector": {"kubernetes.io/hostname": "eks-prod-4"}}}'

Link reference:
https://stackoverflow.com/a/63373332/14312225

CodePudding user response:

Please refer to this link and let us know whether your problem is resolved or not.

  • Related