<p>I am trying to set up a static external IP for my load balancer on GKE but having no luck. Here is my Kubernetes service config file: </p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: myAppService
spec:
  selector:
    app: myApp
  ports:
  - protocol: TCP
    port: 3001
    targetPort: 3001
  type: LoadBalancer
  loadBalancerIP: *********
</code></pre>

<p>This doesn't work. I expect to see my external IP as ********* but it just says pending: </p>

<pre><code>➜  git:(master) kubectl get services
NAME         CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
kubernetes   *********    &lt;none&gt;        443/TCP          5m
myAppService   *********   &lt;pending&gt;     3001:30126/TCP   5m
</code></pre>

<p>More details:   </p>

<pre><code>➜  git:(master) kubectl describe services
Name:           kubernetes
Namespace:      default
Labels:         component=apiserver
            provider=kubernetes
Annotations:        &lt;none&gt;
Selector:       &lt;none&gt;
Type:           ClusterIP
IP:         *********
Port:           https   443/TCP
Endpoints:      *********
Session Affinity:   ClientIP
Events:         &lt;none&gt;


Name:           myAppService
Namespace:      default
Labels:         &lt;none&gt;
Annotations:        &lt;none&gt;
Selector:       app=myApp
Type:           LoadBalancer
IP:         *********
Port:           &lt;unset&gt; 3001/TCP
NodePort:       &lt;unset&gt; 30126/TCP
Endpoints:
Session Affinity:   None
Events:
  FirstSeen LastSeen    Count   From            SubObjectPath   Type        Reason              Message
  --------- --------    -----   ----            -------------   --------    ------              -------
  5m        20s     7   service-controller          Normal      CreatingLoadBalancer        Creating load balancer
  5m        19s     7   service-controller          Warning     CreatingLoadBalancerFailed  Error creating load balancer (will retry): Failed to create load balancer for service default/myAppService: Cannot EnsureLoadBalancer() with no hosts
</code></pre>

<p>Any ideas?</p>

<p>This got me stuck as well, I hope someone finds this helpful.</p>

<p>In addition to what <a href="https://stackoverflow.com/a/51323242/340888">Dirk</a> said, if you happen to reserve a global static IP address as oppose to a regional one; you need to use Ingres as describe here in documentation: <a href="https://cloud.google.com/kubernetes-engine/docs/tutorials/configuring-domain-name-static-ip#step_2b_using_an_ingress" rel="noreferrer">Configuring Domain Names with Static IP Addresses</a> specifically step 2b. </p>

<p>So basically you reserve the static ip <code>gcloud compute addresses create helloweb-ip --global</code></p>

<p>and add an Ingres:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: helloweb
# this is where you you add your reserved ip
  annotations:
    kubernetes.io/ingress.global-static-ip-name: helloweb-ip 
  labels:
    app: hello
spec:
  backend:
    serviceName: helloweb-backend
    servicePort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: helloweb-backend
  labels:
    app: hello
spec:
  type: NodePort
  selector:
    app: hello
    tier: web
  ports:
  - port: 8080
    targetPort: 8080
</code></pre>

<p>The doc also describe how to assign a static ip if you choose type "LoadBalancer" under step 2a.</p>
