<p>I created a regional static IP in the same region of the cluster and I'm trying to use it with a LoadBalancer:</p>

<pre><code>---
apiVersion: v1
kind: Service
metadata:
  name: ambassador
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  ports:
   - port: 80
     targetPort: 8080
  selector:
    service: ambassador
  loadBalancerIP: "x.x.x.x"
</code></pre>

<p>However, I don't know why I am getting this error:</p>

<pre><code>Error creating load balancer (will retry): failed to ensure load balancer for service default/ambassador: requested ip "x.x.x.x" is neither static nor assigned to the LB   
</code></pre>

<p>Edit: Problem solved but ..</p>

<p>When I created the static IP address, I used:</p>

<pre><code>gcloud compute addresses create regional-ip --region  europe-west1
</code></pre>

<p>I used this address with the Service.
It didn't work like I said. </p>

<p>However, when I created an external static regional IP using the web console, the IP worked fine with my Service and it was attached without problems. </p>

<p>My bet is that the source IP service is not exposed then. As the official docs say:</p>

<blockquote>
  <p>As of Kubernetes 1.5, packets sent to Services with Type=LoadBalancer are source NAT’d by default, because all schedulable Kubernetes nodes in the Ready state are eligible for loadbalanced traffic. So if packets arrive at a node without an endpoint, the system proxies it to a node with an endpoint, replacing the source IP on the packet with the IP of the node (as described in the previous section).</p>
</blockquote>

<p>Try this command to expose the source IP service to the loadbalancer: </p>

<p><code>kubectl expose deployment &lt;source-ip-app&gt; --name=loadbalancer --port=80 --target-port=8080 --type=LoadBalancer</code></p>

<p>On this page, you will find more guidance and a number of diagnostic commands for sanity check.</p>

<p><a href="https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-type-loadbalancer" rel="nofollow noreferrer">https://kubernetes.io/docs/tutorials/services/source-ip/#source-ip-for-services-with-type-loadbalancer</a></p>
