apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:
        - mountPath: /etc/nginx/htpasswd
          name: htpasswd
          readOnly: true
        - mountPath: /etc/nginx
          name: nginx-conf
          readOnly: true
      volumes:
      - name: htpasswd
        secret:
          secretName: htpasswd
      - name: nginx-conf
        configMap:
          name: nginx-conf
