<p>I'm trying to deploy nginx-ingress controller in my own server without load balancer and cloud provider. I did the following steps:</p>

<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: ingress-nginx
</code></pre>

<p>Then, I created a cluster role named <code>nginx-ingress</code> for the serviceAccount.<br>
My <code>nginx-controller-service.yaml</code>:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app: ingress-nginx
spec:
  externalTrafficPolicy: Local
  type: NodePort
  selector:
    app: ingress-nginx
  ports:
  - name: http
    port: 80
    targetPort: http
  - name: https
    port: 443
    targetPort: https
  externalIPs:
    - my-external-node-ip
</code></pre>

<p>And <code>nginx-ingress-controller.yaml</code>:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nginx-ingress-controller
  namespace: ingress-nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ingress-nginx
  template:
    metadata:
      labels:
        app: ingress-nginx
      annotations:
        prometheus.io/port: '10254'
        prometheus.io/scrape: 'true'
    spec:
      serviceAccountName: nginx-ingress
      containers:
        - name: nginx-ingress-controller
          image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0-beta.17
          args:
            - /nginx-ingress-controller
            - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          ports:
          - name: http
            containerPort: 80
          - name: https
            containerPort: 443
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 10254
              scheme: HTTP
            initialDelaySeconds: 10
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 10254
              scheme: HTTP
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
</code></pre>

<p>But, when I get the deployment status, it shows me:</p>

<pre><code>NAMESPACE       NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
ingress-nginx   deployment.apps/default-http-backend       1/1     1            1           17m
ingress-nginx   deployment.apps/nginx-ingress-controller   0/1     0            0           17m
</code></pre>

<p>The controller is not available/not running.</p>

<p>What's going wrong here, how to get logs of that failed deployment?</p>

Justinus Hermawan
<p>The issue was caused due to <strong>missing</strong> service account. </p>

<pre><code>58m Warning FailedCreate ReplicaSet Error creating: pods "nginx-ingress-controller-5b7f66f95f-" is forbidden: error looking up service account ingress-nginx/nginx-ingress: serviceaccount "nginx-ingress" not found
</code></pre>

<p>with the following command you can create the SA</p>

<p><code>kubectl create serviceaccount my-service-account</code></p>

<p>for further detail  <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/" rel="nofollow noreferrer">k8s-service-account</a></p>
