title: How-to use existing LoadBalancer in Azure AKS Service?
body: <p>I created a AKS cluster with Terraform. I want the cluster to have a LoadBalancer and a static public IP, and I want those to be pre-existing to my Ingress Controller / LoadBalancer Service definitions, as I don't want them to be created/deleted dynamically by Kubernetes manifests.</p>
  
  <p>So I also created with Terraform a LoadBalancer and a static public IP, in the node resource group and with SKU basic, according to the <a href="https://docs.microsoft.com/bs-cyrl-ba/azure/aks/static-ip" rel="nofollow noreferrer">documentation recommendations</a>, and attached the public IP to the LB.</p>
  
  <p>Then I created a service of type LoadBalancer:</p>
  
  <pre><code>---                                                                                                                                                                                                                                            
  kind: Service
  apiVersion: v1
  metadata:
    name: my-service
  spec:
    type: LoadBalancer
    loadBalancerIP: 8.8.8.8 (the public static IP allocated by Terraform)
    selector:
      name: my-pods-selector
    ports:
      - name: my-port
        protocol: TCP 
        port: 1234
        targetPort: 1234
  </code></pre>
  
  <p>The service is then stuck in the PENDING state, and a <code>describe</code> give me this:</p>
  
  <pre class="lang-sh prettyprint-override"><code>$ kubectl describe svc my-service
  [...]
  Events:
    Type     Reason                      Age               From                Message
    ----     ------                      ----              ----                -------
    Normal   EnsuringLoadBalancer        5s (x9 over 15m)  service-controller  Ensuring load balancer
    Warning  CreatingLoadBalancerFailed  4s (x9 over 15m)  service-controller  Error creating load balancer (will retry): failed to ensure load balancer for service my-service: timed out waiting for the condition
  </code></pre>
  
  <p>I don't manage to find more informations about the error in the <code>describe</code> command output:</p>
  
  <pre class="lang-sh prettyprint-override"><code>Error creating load balancer (will retry): failed to ensure load balancer for service my-service: timed out waiting for the condition
  </code></pre>
  
  <p>Also, if not pre-creating the LoadBalancer but only the public IP, the LoadBalancer is created dynamically and everything is going well.</p>
  
  <p>Question is: <strong>how-to make Azure successfully (which configuration parameter am I missing?) use the pre-existing LB?</strong></p>
  
  <ul>
  <li>Kubernetes version: 1.13.5</li>
  </ul>