<p>I created a custom <code>HTTPS</code> <code>LoadBalancer</code> (<a href="https://i.stack.imgur.com/AHCLr.png" rel="nofollow noreferrer">details</a>) and I need my Kubernetes <code>Workload</code> to be exposed with this <code>LoadBalancer</code>. For now, if I send a request to this endpoint I get the error 502. </p>

<p>When I choose the <code>Expose</code> option in the <code>Workload</code> Console page, there are only <code>TCP</code> and <code>UDP</code> service types available, and a <code>TCP</code> <code>LoadBalancer</code> is created automatically. </p>

<p>How do I expose a Kubernetes <code>Workload</code> with an existing <code>LoadBalancer</code>? Or maybe I don't even need to do it, and requests don't work because my instances are "unhealthy"? (<a href="https://i.stack.imgur.com/JGUEO.png" rel="nofollow noreferrer">healthcheck</a>) </p>

Yolo Tolo
<p>You need to create a kubernetes <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="nofollow noreferrer">ingress</a>.
First, you need to expose the deployment from k8s, for a https choose 443 port and service type can be either: LoadBalance(external ip) or ClusterIp. (you can also test that by accesing the ip or by port forwarding).</p>

<p>Then you need to create the ingress.</p>

<p>Inside yaml file when choosing the backend, set the port and ServiceName that was configured when exposing the deployment.
For example:</p>

<p><code>- path: /some-route
        backend:
          serviceName: your-service-name
          servicePort: 443</code></p>

<p>On gcp, when ingress is created, there will be a load balancer created for that. The backends and instance groups will be automatically build too.
Then if you want to use the already created load balancer you just need to select the backend services from the lb that was created by ingress and add them there.</p>

<p>Also the load balancer will work only if the health checks pass. You need to use the route that will return a <a href="https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-http" rel="nofollow noreferrer">200 HTTPS response</a> for that.</p>
