Difference between revisions of "Spec:"

From wikieduonline
Jump to navigation Jump to search
Line 16: Line 16:
 
         [[tty:]] true
 
         [[tty:]] true
 
         [[stdin:]] true
 
         [[stdin:]] true
 +
 +
== Official example container using secrets ==
 +
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 ==
 
== Related ==

Revision as of 09:44, 12 October 2022

kind: Pod
kind: Deployment
kind: CronJob


spec:
  containers:
  - name: MyNginxContainer
    image: nginx
spec:
     containers:
     - name: your-name
       image: your-name:latest
       tty: true
       stdin: true

Official example container using secrets

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

See also

Advertising: