<p>I have an Azure Kubernetes Service cluster and created a public IP address via:</p>
<blockquote>
<p>az network public-ip create --resource-group MC_myResourceGroup_myAKSCluster_eastus --name myAKSPublicIP --sku Standard --allocation-method static --query publicIp.ipAddress -o tsv</p>
</blockquote>
<p>I created the ingress controller via:</p>
<blockquote>
<p>kubectl apply -f <a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml</a></p>
</blockquote>
<p>To try and add the IP address to the ingress-controller, I tried following <a href="https://learn.microsoft.com/en-us/azure/aks/ingress-tls?tabs=azure-cli" rel="nofollow noreferrer">this tutorial</a>, but since I have not installed the ingress controller via helm it does not seem to be working.</p>
<p>An important note is that, without the Azure IP address, the ingress controller does work, but I want to create a static IP so that it does not get delete when the ingress controller gets deleted.</p>
<p>Update:</p>
<p>I followed @silent's advice by:</p>
<ol>
<li>Going to: <a href="https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml" rel="nofollow noreferrer">https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml</a></li>
<li>Copying the yaml code and pasting it in a file</li>
<li>Adding the lines @silent provided in the following piece from the yaml:</li>
</ol>
<pre><code>kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path: /healthz
    service.beta.kubernetes.io/azure-load-balancer-ipv4: &lt;Azure-IP&gt;
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
    app.kubernetes.io/version: 1.8.1
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  externalTrafficPolicy: Local
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - appProtocol: http
    name: http
    port: 80
    protocol: TCP
    targetPort: http
  - appProtocol: https
    name: https
    port: 443
    protocol: TCP
    targetPort: https
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  type: LoadBalancer
</code></pre>
<p>When I apply the file without the annotations @silent provided, it works, but of course with a random IP address. When I add the annotations, the service's EXTERNAL-IP will remain &lt;PENDING&gt;.</p>

Jens Voorpyl
<p>You just need to adjust your yaml file and set the IP address of the service (through annotations, as this is the currently recommended way):</p>
<p>Should be this one</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-health-probe-request-path: /healthz
    service.beta.kubernetes.io/azure-load-balancer-ipv4: 1.2.3.4 # &lt;-- here put your ip
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
    app.kubernetes.io/version: 1.8.1
  name: ingress-nginx-controller
  namespace: ingress-nginx
spec:
  externalTrafficPolicy: Local
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - appProtocol: http
    name: http
    port: 80
    protocol: TCP
    targetPort: http
  - appProtocol: https
    name: https
    port: 443
    protocol: TCP
    targetPort: https
  selector:
    app.kubernetes.io/component: controller
    app.kubernetes.io/instance: ingress-nginx
    app.kubernetes.io/name: ingress-nginx
  type: LoadBalancer
</code></pre>
