<p>I have allocated a static IP on my GCP account. Then, I updated my application's service definition to use this in a load balancer, like so:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  # Unique key of the Service instance
  name: my-app-service
spec:
  ports:
    # Accept traffic sent to port 80
    - name: http
      port: 80
      targetPort: 5000
  selector:
    # Loadbalance traffic across Pods matching
    # this label selector
    app: web
  # Create an HA proxy in the cloud provider
  # with an External IP address - *Only supported
  # by some cloud providers*
  type: LoadBalancer
  # Use the static IP allocated
  loadBalancerIP: 35.186.xxx.xxx
</code></pre>

<p>If I comment out the last line and let GKE allocate an ephemeral public IP, the service comes up just fine. Any ideas what I am doing wrong?</p>

<p>Based on advise in an answer, I created an <code>Ingress</code> as follows:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myapp
  annotations:
    kubernetes.io/ingress.global-static-ip-name: "myapp"
spec:
  backend:
    serviceName: my-app-service
    servicePort: 80
</code></pre>

<p>Now, I see the <code>Ingress</code> getting assigned the right static IP. However, my <code>Service</code> also gets assigned a (different) public IP. The <code>Ingress</code> and <code>Service</code> are not connected. If I comment out the <code>type: LoadBalancer</code> line, the <code>Service</code> is not assigned a public IP, but <code>Ingress</code> still does not connect. I get a <code>default backend - 404</code> response when hitting the static IP. I have tried creating the service and ingress in different orders and that has not helped either.</p>

<p>If I leave this up long enough, the static IP routes traffic to my service, but the service itself stays stuck in external IP assignment:</p>

<pre><code>$ kubectl get service my-app-service
NAME                   CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
my-app-service          10.x.x.x        &lt;pending&gt;     80:31432/TCP   12m
</code></pre>

<p>You need to create an <code>Ingress</code> and use the <code>kubernetes.io/ingress.global-static-ip-name: "name-of-your-ip"</code> annotation on the Ingress for Kubernetes to be able to find it. </p>

<p>You can find a tutorial here: <a href="https://github.com/kelseyhightower/ingress-with-static-ip#tutorial" rel="nofollow noreferrer">https://github.com/kelseyhightower/ingress-with-static-ip#tutorial</a></p>
