Hi all, Is there a way to pass a dynamic value to a manifest? At the time of running ‘kubectl apply’ I need a variable to be populated with the ‘env variable’ of the host where we are going to ‘apply’ the manifest. In the below sample example, instead of passing a fixed host ip, I need it to be populated with the latest host ip available as env variable.
- name: env-print-demo
- name: INGRESS_HOST
can you check check this one https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
Configure your YAML to store placeholder as the value. Then process the file on the fly changing the placeholder with the actual IP address, and pipe output to kubectl apply -f -.
Lisenet, I see what you are suggesting. I was wondering if there was a simpler way to do, wherein the pod manifest directly picks up the value from the current host env vars.
Karthikeyan, I had looked at data injection in k8s doc, but that doesn’t address this use case.
Yea, you can do that as well.