I want to specify the node of the scheduling destination for all pods deployed in operator.yaml

11/17/2020

I want to specify the node of the scheduling destination for all pods deployed in operator.yaml.

        # (Optional) Discover Agent NodeAffinity.
        - name: DISCOVER_AGENT_NODE_AFFINITY
          value: "role=storage"
  rook-ceph                   rook-discover-29qtt                                                0 (0%)        0 (0%)      0 (0%)      

I also want to deploy other operator-pods (csi-cephfsplugin / provider, csi-ebdplugin / provider) on the specified storage node. What yaml should I write?

-- メイカー
ceph
kubernetes

1 Answer

11/17/2020

You can use nodeSelector field in podSpec to select the nodes where you want the given pod to run. You will have to add a label to the target node first(e.g. nodeType=storage), then add the same label-selector in nodeSelector field in podSpec.

Example from K8s Documentation:

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
  nodeSelector:
    disktype: ssd

https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/

-- Abhishek Jaisingh
Source: StackOverflow