I need to provide a list of hostnames under kubernetes.io/hostname
nodeSelector. I tried giving comma separated list but kubernetes throws some validation error when I do kubectl apply -f <yaml file>
.
I also tried giving multiple hostnames by providing repeated sets of kubernetes.io/hostname
, but kubernetes takes only the last value. Could not find any valid example when I browsed.
Thanks
The DaemonSet "ssh-daemonset" is invalid: spec.template.spec.nodeSelector: Invalid value: "1z.t3.x52.y7,l0.1k7.1p0.2q0": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
To constrain DaemonSet pods to run on specific nodes only, see https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/#running-pods-on-only-some-nodes
Using the same label, label the nodes on which you want the DaemonSet pods to run (kubectl label nodes <node-name> <label-key>=<label-value>
) and specify that label in spec.template.spec.nodeSelector
.
Example: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector