apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-ingress
  namespace: nginx-ingress
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-ingress
  template:
    metadata:
      labels:
        app: nginx-ingress
      #annotations:
      #prometheus.io/scrape: "true"
      #prometheus.io/port: "9113"
    spec:
      serviceAccountName: nginx-ingress
      containers:
        - image: nginx/nginx-ingress:edge
          imagePullPolicy: Always
          name: nginx-ingress
          ports:
            - name: http
              containerPort: 80
            - name: https
              containerPort: 443
          #- name: prometheus
          #containerPort: 9113
          securityContext:
            allowPrivilegeEscalation: true
            runAsUser: 101 #nginx
            capabilities:
              drop:
                - ALL
              add:
                - NET_BIND_SERVICE
          env:
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          args:
            - -nginx-configmaps=$(POD_NAMESPACE)/nginx-config
            - -default-server-tls-secret=$(POD_NAMESPACE)/default-server-secret
            #- -v=3 # Enables extensive logging. Useful for troubleshooting.
            #- -report-ingress-status
            #- -external-service=nginx-ingress
            #- -enable-leader-election
            #- -enable-prometheus-metrics
            #- -enable-custom-resources
