apiVersion: apps/v1
kind: Deployment
metadata:
  name: pear-test
  namespace: pear-test-ns
  labels:
    app: pear
spec:
  replicas: 3
  selector:
    matchLabels:
      app: pear
  template:
    metadata:
      namespace: pear-test-ns
      labels:
        app: pear
    spec:
      containers:
        - name: pear-test
          image: ants/pear:v5.0
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 6666
          volumeMounts:
            - mountPath: /data/pear
              name: pear-volume
            - mountPath: /data/pear_pvc
              name: pear-store
            - mountPath: /data/pear_secret
              name: pear-secret
              readOnly: true
            - mountPath: /data/pear_config
              name: pear-config
              readOnly: true
            - mountPath: /data/pear_config2
              name: pear-config2
              readOnly: true
          env:
            - name: ENV01
              value: "1"
            - name: ENV02
              value: "2"
            - name: USERNAME1
              valueFrom:
                secretKeyRef:
                  name: mysecret2
                  key: username
            - name: PASSWORD1
              valueFrom:
                secretKeyRef:
                  name: mysecret2
                  key: password
            - name: SPECIAL_LEVEL_KEY
              valueFrom:
                configMapKeyRef:
                  name: myconfig2
                  key: special.how
      volumes:
        - name: pear-volume
          hostPath:
            path: /home/data
            type: Directory
        - name: pear-store
          persistentVolumeClaim:
            claimName: nfs-pvc
        - name: pear-secret
          secret:
            secretName: mysecret1
        - name: pear-config
          configMap:
            name: myconfig1
        - name: pear-config2
          configMap:
            name: myconfig2
      serviceAccountName: pear-sa
