Difference between revisions of "Spec.NodeSelector"
Jump to navigation
Jump to search
(3 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
env: test | env: test | ||
spec: | spec: | ||
− | containers: | + | [[containers:]] |
- name: nginx | - name: nginx | ||
image: nginx | image: nginx | ||
Line 46: | Line 46: | ||
nodeSelector: | nodeSelector: | ||
[[karpenter.sh/provisioner-name:]] XXXXX | [[karpenter.sh/provisioner-name:]] XXXXX | ||
− | |||
== DaemonSet == | == DaemonSet == | ||
Line 52: | Line 51: | ||
* <code>[[kubectl patch]] daemonset <name-of-daemon-set> -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'</code> | * <code>[[kubectl patch]] daemonset <name-of-daemon-set> -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'</code> | ||
Start [[DaemonSet]] by removing the [[nodeSelector]] : | Start [[DaemonSet]] by removing the [[nodeSelector]] : | ||
− | * <code>kubectl patch daemonset <name-of-daemon-set> --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'</code> | + | * <code>kubectl patch daemonset <name-of-daemon-set> --type json -p='[{"op": "remove", "path": "[[/spec/template/spec/nodeSelector/]]non-existing"}]'</code> |
== Activities == | == Activities == | ||
Line 71: | Line 70: | ||
* {{K8s nodes}} | * {{K8s nodes}} | ||
* {{Pods}} | * {{Pods}} | ||
+ | * {{affinity}} | ||
[[Category:Kubernetes]] | [[Category:Kubernetes]] |
Latest revision as of 07:22, 25 July 2024
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[edit]
nodeSelector: topology.kubernetes.io/zone: us-west-2a karpenter.sh/capacity-type: spot
nodeSelector: karpenter.sh/provisioner-name: XXXXX
DaemonSet[edit]
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[edit]
- CKA v1.21: Understand how to use Labels, Selector and Annotations
- CKA v1.18: Use label selectors to schedule Pods
- CKA v1.15: Understand how to use Labels, Selector and Annotations
- Use
NodeSelector
assign pod to specific node
Related terms[edit]
- Kubernetes scheduling
kubectl label
kubectl apply
nodeAffinity
- Kubernetes Pod Topology Spread Constraints
selector:
See also[edit]
- Kubernetes nodes,
node.kubernetes.io
K8s Node controller (node-controller),MemoryPressure, DiskPressure, NodeHasDiskPressure, events, NodeNotReady
, Node-pressure Eviction, RemovingNode, ProviderID,kubectl node-shell, kubectl describe nodes
- Pods:
kubectl apply
,kubectl [ pod get | top | delete | describe pods ]
,InitContainers, PodInitializing, CrashLoopBackOff, ImagePullPolicy:, NodeAffinity, NodeSelector, Terminated
- Kubernetes pod affinity and anti affinity, Kubernetes Node Affinity,
default-scheduler, affinity:, NodeAffinity, spec.affinity.podAntiAffinity
Advertising: