Skip to content

Latest commit

 

History

History
35 lines (30 loc) · 741 Bytes

14-NODE-AFFINITY.md

File metadata and controls

35 lines (30 loc) · 741 Bytes

How to create kubectl alias (optional):

  • alias k=kubectl

Show all labels on the nodes:

  • k get nodes --show-labels

Create a label

  • k label nodes node1 app=ssd

Add a Label on a POD:

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
spec:
  containers:
  - image: nginx
    name: nginx-container
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: app
            operator: In
            values:
            - ssd

Remove a taint from a Node:

  • kubectl taint nodes controlplane node-role.kubernetes.io/master:NoSchedule-

To see more details of the a POD:

  • k get po -o wide