Hi all, Is there a way to pass a dynamic value to a manifest? At the time of run . . .

gopi m:
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.
apiVersion: v1
kind: Pod
metadata:
name: print-greeting
spec:
containers:
- name: env-print-demo
image: bash
env:
- name: INGRESS_HOST
value: <ingress_host_ip>
command: ["echo"]
args: ["$(INGRESS_HOST)"]

Karthikeyan Duraisamy:
can you check check this one https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/

Lisenet:
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 -.

gopi m:
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.

Lisenet:
Yea, you can do that as well.