'variable substitution in a Kubernetes YAML file
I have a deployments.yaml
file and for a hostpath in my spec I am doing something like this:
spec:
volumes:
- name: fe-source
hostPath:
path: /home/myname/src/TargetDirectory
notice here that the path mounted is an absolute path starting from my root folder all the way to my target directory. Now if I was developing solo, this would be just fine, I guess but the goal here is to collaborate with other devs and it would make much more sense to use a relative path. Something to the effect of
spec:
volumes:
- name: fe-source
hostPath:
path: ../../../src/TargetDirectory
however, it appears that relative paths are not supported. I was wondering if there was a way to maybe incorporate an environment variable such ${PWD}
so that no matter which dev is working locally, they could just clone the repo and start as opposed to having to change that out for each dev
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|