title: Deploying an NGINX Ingress Controller on AWS
body: <p>I have tried to deploy an nginx-ingress controller on AWS using this guide:</p>
  
  <pre><code>https://github.com/kubernetes/ingress-nginx/blob/master/deploy/README.md
  </code></pre>
  
  <p>Everything seems to be working fine until this step:</p>
  
  <pre><code>kubectl patch deployment -n ingress-nginx nginx-ingress-controller --namespace  ingress-nginx --type='json' --patch="$(curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/publish-service-patch.yaml)"
  </code></pre>
  
  <p>Before I run the above command I can list the deployments and all looks good.</p>
  
  <pre><code>NAME                       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
  default-http-backend       1         1         1            1           2m
  nginx-ingress-controller   1         1         1            1           2m
  </code></pre>
  
  <p>After I execute the command the nginx-ingress-controller is no longer available.</p>
  
  <pre><code>NAME                       DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
  default-http-backend       1         1         1            1           6m
  nginx-ingress-controller   1         1         1            0           6m
  </code></pre>
  
  <p>I'm not sure what is going on here. Any ideas?</p>
  
  <p>The pods:</p>
  
  <pre><code>NAME                                        READY     STATUS             RESTARTS   AGE
  default-http-backend-170366572-bz7vw        1/1       Running            0          2h
  nginx-ingress-controller-2196833065-nd4jl   0/1       CrashLoopBackOff   35         2h
  </code></pre>
  
  <p>The nginx-ingress-controller-2196833065-nd4jl logs</p>
  
  <pre><code>-------------------------------------------------------------------------------
  NGINX Ingress controller
    Release:    0.9.0
    Build:      git-6816630
    Repository: https://github.com/kubernetes/ingress-nginx
  -------------------------------------------------------------------------------
  
  I0115 16:14:49.242875       6 main.go:227] Creating API client for     https://100.64.0.1:443
  I0115 16:14:49.250479       6 main.go:239] Running in Kubernetes Cluster version v1.7 (v1.7.11) - git (clean) commit b13f2fd682d56eab7a6a2b5a1cab1a3d2c8bdd55 - platform linux/amd64
  I0115 16:14:49.252350       6 main.go:83] validated ingress-nginx/default-http-backend as the default backend
  F0115 16:14:49.254160       6 main.go:93] unexpected error getting information about service ingress-nginx/ingress-nginx: services "ingress-nginx" not found
  </code></pre>
  
  <p>nginx-ingress-controller-2196833065-nd4jl pod description</p>
  
  <pre><code>Name:           nginx-ingress-controller-2196833065-nd4jl
  Namespace:      ingress-nginx
  Node:           ip-172-20-40-8.eu-west-2.compute.internal/172.20.40.8
  Start Time:     Mon, 15 Jan 2018 13:40:16 +0000
  Labels:         app=ingress-nginx
                  pod-template-hash=2196833065
  Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"ingress-nginx","name":"nginx-ingress-controller-2196833065","uid":"9ed60e34-f9f9-...
                  prometheus.io/port=10254
                  prometheus.io/scrape=true
  Status:         Running
  IP:             100.96.1.41
  Controlled By:  ReplicaSet/nginx-ingress-controller-2196833065
  Containers:
    nginx-ingress-controller:
      Container ID:  docker://e6da516c1462a37785f8c3617cc8982faf0e0d4c0576600684934fbdd786a12e
      Image:         quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0
      Image ID:      docker-pullable://quay.io/kubernetes-ingress-controller/nginx-ingress-controller@sha256:39cc6ce23e5bcdf8aa78bc28bbcfe0999e449bf99fe2e8d60984b417facc5cd4
      Ports:         80/TCP, 443/TCP
      Args:
        /nginx-ingress-controller
        --default-backend-service=$(POD_NAMESPACE)/default-http-backend
        --configmap=$(POD_NAMESPACE)/nginx-configuration
        --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
        --udp-services-configmap=$(POD_NAMESPACE)/udp-services
        --annotations-prefix=nginx.ingress.kubernetes.io
        --publish-service=$(POD_NAMESPACE)/ingress-nginx
      State:          Waiting
        Reason:       CrashLoopBackOff
      Last State:     Terminated
        Reason:       Error
        Exit Code:    255
        Started:      Mon, 15 Jan 2018 16:19:52 +0000
        Finished:     Mon, 15 Jan 2018 16:19:52 +0000
      Ready:          False
      Restart Count:  36
      Liveness:       http-get http://:10254/healthz delay=10s timeout=1s period=10s #success=1 #failure=3
      Readiness:      http-get http://:10254/healthz delay=0s timeout=1s period=10s #success=1 #failure=3
      Environment:
        POD_NAME:       nginx-ingress-controller-2196833065-nd4jl (v1:metadata.name)
        POD_NAMESPACE:  ingress-nginx (v1:metadata.namespace)
      Mounts:
        /var/run/secrets/kubernetes.io/serviceaccount from default-token-33qvw (ro)
  Conditions:
    Type           Status
    Initialized    True
    Ready          False
    PodScheduled   True
  Volumes:
    default-token-33qvw:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  default-token-33qvw
      Optional:    false
  QoS Class:       BestEffort
  Node-Selectors:  &lt;none&gt;
  Tolerations:     node.alpha.kubernetes.io/notReady:NoExecute for 300s
                   node.alpha.kubernetes.io/unreachable:NoExecute for 300s
  Events:
    Type     Reason      Age                 From                                                Message
    ----     ------      ----                ----                                                -------
    Normal   Pulled      1m (x37 over 2h)    kubelet, ip-172-20-40-8.eu-west-2.compute.internal  Container image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.9.0" already present on machine
    Normal   Created     1m (x37 over 2h)    kubelet, ip-172-20-40-8.eu-west-2.compute.internal  Created container
    Normal   Started     1m (x37 over 2h)    kubelet, ip-172-20-40-8.eu-west-2.compute.internal  Started container
    Warning  BackOff     10s (x757 over 2h)  kubelet, ip-172-20-40-8.eu-west-2.compute.internal  Back-off restarting failed container
    Warning  FailedSync  10s (x757 over 2h)  kubelet, ip-172-20-40-8.eu-west-2.compute.internal  Error syncing pod
  </code></pre>