Difference between revisions of "SecretKeyRef"

From wikieduonline
Jump to navigation Jump to search
(Created page with " <pre> apiVersion: v1 kind: Pod metadata: name: secret-env-pod spec: containers: - name: mycontainer image: redis env: - name: SECRET_USERNAME val...")
 
Line 1: Line 1:
 +
{{lc}}
  
 
+
== Official example ==
 
<pre>
 
<pre>
 
apiVersion: v1
 
apiVersion: v1

Revision as of 19:03, 20 September 2022

Official example

apiVersion: v1
kind: Pod
metadata:
  name: secret-env-pod
spec:
  containers:
  - name: mycontainer
    image: redis
    env:
      - name: SECRET_USERNAME
        valueFrom:
          secretKeyRef:
            name: mysecret
            key: username
            optional: false # same as default; "mysecret" must exist
                            # and include a key named "username"
      - name: SECRET_PASSWORD
        valueFrom:
          secretKeyRef:
            name: mysecret
            key: password
            optional: false # same as default; "mysecret" must exist
                            # and include a key named "password"
  restartPolicy: Never


Advertising: