<p>I am running web site with Kubernetes on Google Cloud. At the moment, everything is working well - through http. But I need https. I have several services and one of them is exposed to the outside world, let's call it web. As far as I know, this is the only service that needs to be modified. I tried to creating a static IP and TCP/SSL loadbalancer ssl-LB in the Networking section of GCP and using that LB in web.yaml, which I create. Creating the service gets stuck with:</p>

<pre><code>Error creating load balancer (will retry): Failed to create load 
balancer for service default/web: requested ip &lt;IP&gt; is 
neither static nor assigned to LB
aff3a4e1f487f11e787cc42010a84016(default/web): &lt;nil&gt;
</code></pre>

<p>According to GCP my IP is static, however. The hashed LB I cannot find anywhere and it should be assigned to ssl-LB anyway. How do I assign this properly?</p>

<p><strong>More details:</strong></p>

<p>Here are the contents of web.yaml</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
name: web
labels:
  ...
spec:
  type: LoadBalancer
  loadBalancerIP: &lt;RESERVED STATIC IP&gt; 
ports:
- port: 443
  targetPort: 7770
selector:
  ...
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 1
  template:
    metadata:
      labels:
        ...
  spec:
    containers:
    - name: web
      image: gcr.io/&lt;PROJECT&gt;/&lt;IMAGE NAME&gt;
      ports:
      - containerPort: 7770
</code></pre>

<p>Since you have not mentioned this already, I'm just assuming you're using Google Container Engine (GKE) for your Kubernetes setup.</p>

<p>In the service resource manifest, if you set the <a href="https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer" rel="noreferrer"><code>Type</code> to <code>LoadBalancer</code></a>, Kubernetes on GKE automatically sets up Network load balancing (L4 Load balancer) using GCE. You will have to terminate connections in your pod using your own custom server or something like <code>nginx</code>/<code>apache</code>.</p>

<p>If your goal is to set up a (HTTP/HTTPS) L7 load balancer (which looks to be the case), it will be simpler and easier to use the <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="noreferrer"><code>Ingress</code> resource in Kubernetes</a> (starting with <code>v1.1</code>). GKE automatically sets up a GCE HTTP/HTTPS L7 load balancing with this setup.</p>

<p>You will be able to add your TLS certificates which will get provisioned on the GCE load balancer automatically by GKE.</p>

<p>This setup has the following advantages:</p>

<ol>
<li>Specify services per URL path and port (it uses <a href="https://cloud.google.com/compute/docs/load-balancing/http/url-map" rel="noreferrer"><code>URL Maps</code></a> from GCE to configure this).</li>
<li>Set up and terminate SSL/TLS on the GCE load balancer (it uses <a href="https://cloud.google.com/compute/docs/load-balancing/http/target-proxies" rel="noreferrer"><code>Target proxies</code></a> from GCE to configure this).</li>
<li>GKE will automatically also configure the GCE <a href="https://cloud.google.com/compute/docs/load-balancing/health-checks" rel="noreferrer"><code>health checks</code></a> for your services.</li>
</ol>

<p>Your responsibility will be to handle the backend service logic to handle requests in your pods.</p>

<p>More info available on the <a href="https://cloud.google.com/container-engine/docs/tutorials/http-balancer" rel="noreferrer">GKE page about setting up HTTP load balancing</a>.</p>

<p>Remember that when using GKE, it automatically uses the available GCE load balancer support for both the use cases described above and you will not need to manually set up <a href="https://cloud.google.com/compute/docs/load-balancing/" rel="noreferrer">GCE load balancing</a>.</p>
