Is there a way to put Kubernetes secret value in args field of yaml file Is there a way to put Kubernetes secret value in args field of yaml file kubernetes kubernetes

Is there a way to put Kubernetes secret value in args field of yaml file


Once you have an environment variable you can embed its value into the arguments:

env:- name: MESSAGE  value: "hello world"command: ["/bin/echo"]args: ["$(MESSAGE)"]

Or in your case:

args:        - "-db_host=postgres"        - "-db_port=5432"        - "-db_username=$(db_username)"        - "-db_password=$(db_password)"env:        - name: db_username          valueFrom:            secretKeyRef:              name: db-secret              key: db-user        - name: db_password          valueFrom:            secretKeyRef:              name: db-secret              key: db-pass

The reference can be found here