Expand the env value defined in kubernetes definition to container
- name: NRIA_DISPLAY_NAME value: abc-$HOSTNAME
should have two changes made to it:
Ensure the thing you wish to have substituted is also present in the
env:
block -- I know you might think$HOSTNAME
is universally populated, but that's not always true, and it is for sure not true in the kubernetes mental modelUse the syntax
$(INTERPOLATION_HERE)
rather than the bash-centric$VAR
or${VAR}
. That syntax is documented in thePodSpec
reference
Thus:
env:- name: HOSTNAME valueFrom: fieldRef: fieldPath: metadata.name # or "status.hostIP" or "spec.nodeName" etc- name: NRIA_DISPLAY_NAME value: abc-$(HOSTNAME)