Difference between revisions of "SecretKeyRef"

From wikieduonline
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
  
 
== Official example ==
 
== Official example ==
<pre>
+
https://kubernetes.io/docs/concepts/configuration/secret/
apiVersion: v1
+
 
kind: Pod
+
{{K8s secret official example}}
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
 
</pre>
 
  
 
== Related ==
 
== Related ==

Latest revision as of 09:46, 12 October 2022

Official example[edit]

https://kubernetes.io/docs/concepts/configuration/secret/

 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

Related[edit]

See also[edit]

Advertising: