apiVersion: apps/v1
kind: Deployment
metadata:
  name: secretvars
  labels:
    app: secretvars
spec:
  replicas: 3
  selector:
    matchLabels:
      app: secretvars
  template:
    metadata:
      labels:
        app: secretvars
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
        env:
        - name: VAR
          valueFrom:
            secretKeyRef:
              name: sample
              key: key2