title: Change Kubernetes nginx-ingress-controller ports
body: <p>I installed Minikube v1.3.1 on my RedHat EC2 instance for some tests. </p>
  
  <p><strong><em>Since the ports that the nginx-ingress-controller uses by default are already in use, I am trying to change them in the deployment but without result. Could please somebody advise how to do it?</em></strong></p>
  
  <p><strong>How do I know that the port are already in Use?</strong></p>
  
  <p>When I listed the system pods using the command <code>kubectl -n kube-system get deployment | grep nginx</code>, I get:</p>
  
  <blockquote>
    <p>nginx-ingress-controller   0/1     1            0           9d</p>
  </blockquote>
  
  <p>meaning that my container is not up. When I describe it using the command <code>kubectl -n kube-system describe pod nginx-ingress-controller-xxxxx</code> I get:</p>
  
  <blockquote>
    <p>Type     Reason                  Age                        From<br>
    Message   ----     ------                  ----<br>
    ----               -------   Warning  FailedCreatePodSandBox  42m (x163507 over 2d1h)    kubelet, minikube  (combined from similar
    events): Failed create pod sandbox: rpc error: code = Unknown desc =
    failed to start sandbox container for pod
    "nginx-ingress-controller-xxxx": Error response from daemon: driver
    failed programming external connectivity on endpoint
    k8s_POD_nginx-ingress-controller-xxxx_kube-system_...: Error starting
    userland proxy: listen tcp 0.0.0.0:443: bind: address already in use</p>
  </blockquote>
  
  <p>Then I check the processes using those ports and I kill them. That free them up and the ingress-controller pod gets deployed correctly. </p>
  
  <p>What did I try to change the nginx-ingress-controller port?</p>
  
  <pre><code>kubectl -n kube-system get deployment | grep nginx
  
  &gt; NAME                       READY   UP-TO-DATE   AVAILABLE   AGE
  &gt; nginx-ingress-controller   0/1     1            0           9d
  
  kubectl -n kube-system edit deployment nginx-ingress-controller
  </code></pre>
  
  <p>The relevant part of my deployment looks like this:</p>
  
  <pre><code>name: nginx-ingress-controller
          ports:
          - containerPort: 80
            hostPort: 80
            protocol: TCP
          - containerPort: 443
            hostPort: 443
            protocol: TCP
          - containerPort: 81
            hostPort: 81
            protocol: TCP
          - containerPort: 444
            hostPort: 444
            protocol: TCP
          - containerPort: 18080
            hostPort: 18080
            protocol: TCP
  </code></pre>
  
  <p>Then I remove the subsections with port 443 and 80, but when I rollout the changes, <strong>they get added again</strong>.</p>
  
  <p>Now my services are not reachable anymore through ingress.</p>