Difference between revisions of "Spec.NodeSelector"

From wikieduonline
Jump to navigation Jump to search
Line 66: Line 66:
 
* <code>[[nodeAffinity]]</code>
 
* <code>[[nodeAffinity]]</code>
 
* [[Kubernetes Pod Topology Spread Constraints]]
 
* [[Kubernetes Pod Topology Spread Constraints]]
[[selector:]]
+
* <code>[[selector:]]</code>
  
 
== See also ==
 
== See also ==

Revision as of 16:11, 21 December 2022

apiVersion: v1
kind: Pod
metadata:
  name: nginx
  labels:
    env: test
spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  nodeSelector:
    disktype: ssd
apiVersion: v1

kind: Pod

metadata:

  name: nginx

spec:

  nodeName: foo-node # schedule pod to specific node

  containers:

  - name: nginx

    image: nginx

    imagePullPolicy: IfNotPresent

Karpenter

nodeSelector:
  topology.kubernetes.io/zone: us-west-2a
  karpenter.sh/capacity-type: spot
nodeSelector:
  karpenter.sh/provisioner-name: XXXXX


DaemonSet

Stop DaemonSet by appliying a nodeSelector

  • kubectl patch daemonset <name-of-daemon-set> -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'

Start DaemonSet by removing the nodeSelector :

  • kubectl patch daemonset <name-of-daemon-set> --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'

Activities

Related terms

See also

Advertising: