apiVersion: v1
kind: Pod
metadata:
  name: pod-with-secret
spec:
  containers:
  - name: pod-with-secret
    image: web
    # We need to set imagePullPolicy=Never to ensure that k8s will search our local images.
    # More info: https://stackoverflow.com/questions/42564058/how-to-use-local-docker-images-with-minikube
    imagePullPolicy: Never
    ports:
      - containerPort: 1234

    # Consume secret in env variable: value is defined at creation time.
    env:
        - name: SECRET_USERNAME
          valueFrom:
            secretKeyRef:
              name: mysecret
              key: username

    # Consume secret from 
    volumeMounts:
      - name: mysecretsvol
        mountPath: "/tmp/mysecrets"
        readOnly: true

  volumes:
  - name: mysecretsvol
    secret:
      secretName: mysecret