The nodeSelectorTerms in a PersistentVolume help the volume identify which node to bind to. For example:
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- mynodename
means that we only want to bind to a node of the name mynodename
.
I would like to replace mynodename
with a variable defined in a configMap. For example, the following syntax is what I was imagining, but it does not work:
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- valueFrom:
configMapKeyRef:
name: my-configmap
key: MYNODENAME
where my-configmap
is a configmap and MYNODENAME
is a variable in it.
Can I achieve this somehow?
This is not supported. Apparently I need more words than just that.