---
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-configmap
data:
  default.conf: |
    server {
      listen 80;
      server_name  localhost;
      location /nginx_status {
        stub_status on;
        access_log off;
        allow all;
      }
    }
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      annotations:
        allowScraping: "true"
      labels:
        app: nginx
    spec:
      containers:
        - name: nginx
          image: nginx:latest
          ports:
            - containerPort: 80
              name: http
          volumeMounts:
            - name: nginx-conf
              mountPath: /etc/nginx/conf.d
          resources:
            requests:
              cpu: 100m
          readinessProbe:
            httpGet:
              path: /nginx_status
              port: 80
            initialDelaySeconds: 5
            periodSeconds: 5
            timeoutSeconds: 5
      volumes:
        - name: nginx-conf
          configMap:
            name: nginx-configmap
