How do I pass in a variable inside another string value in k8s deployments.
Asked
Active
Viewed 372 times
1 Answers
4
Variable references are possible using the $(ENV_VAR)
format.
So, in this example, it would be:
containers:
- env:
- name: DATA_SOURCE_PASS
valueFrom:
secretKeyRef:
name: app-secrets
key: DB_DOCKER_USER_PASSWORD
- name: PG_EXPORTER_URL
value: postgres://postgres:$(DATA_SOURCE_PASS)@localhost:5432/postgres
- This question has already been answered here, which is where I got this answer from.
- Kubernetes documentation on variable references, also linked from article above.

Gavin
- 349
- 4
- 10