apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        volumeMounts:
          - mountPath: /etc/nginx/conf.d/default.conf 
            subPath: default.conf 
            name: nginx-default-conf-vol
        ports:
        - containerPort: 8000
      - name: nginx-exporter
        image: nginx/nginx-prometheus-exporter
        args: ['-nginx.scrape-uri', 'http://localhost:8000/basic_status']
        ports:
          - containerPort: 9113
            name: port-metrics
      volumes:
      - name: nginx-default-conf-vol
        configMap:
          name: nginx-default-conf
