apiVersion: apps/v1
kind: Deployment
metadata:
  name: nghttpx-ingress-controller
  namespace: kube-system
  labels:
    k8s-app: nghttpx-ingress-lb
spec:
  selector:
    matchLabels:
      k8s-app: nghttpx-ingress-lb
  template:
    metadata:
      labels:
        k8s-app: nghttpx-ingress-lb
        name: nghttpx-ingress-lb
    spec:
      serviceAccountName: ingress
      terminationGracePeriodSeconds: 60
      hostNetwork: true
      containers:
      - image: zlabjp/nghttpx-ingress-controller:latest
        name: nghttpx-ingress-lb
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
            path: /healthz
            # when changing this port, also specify it using --healthz-port in nghttpx-ingress-controller args.
            port: 11249
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 5
        # use downward API
        env:
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
        ports:
        - containerPort: 80
          hostPort: 80
        - containerPort: 443
          hostPort: 443
        args:
        - /nghttpx-ingress-controller
        - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
        - --healthz-port=11249
