Expose Google Kubernetes Engine Application with Cloud Load Balancing

How to Expose Your Application with Cloud Load Balancing in Google Kubernetes Engine (GKE)

Question

Your application is deployed in a Google Kubernetes Engine (GKE) cluster.

You want to expose this application publicly behind a Cloud Load Balancing HTTP(S) load balancer.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

https://cloud.google.com/kubernetes-engine/docs/concepts/ingress

To expose an application publicly behind a Cloud Load Balancing HTTP(S) load balancer in a GKE cluster, the recommended approach is to use an Ingress resource. Therefore, the correct answer is A. Configure a GKE Ingress resource.

An Ingress resource is a Kubernetes resource that allows you to configure how external traffic is routed to your services in the cluster. It acts as a layer 7 (application layer) load balancer that can direct traffic based on the request hostname or path. An Ingress controller is needed to process the Ingress resource and configure the load balancer.

To create an Ingress resource in GKE, follow these steps:

  1. Create a Kubernetes service for your application: A service is responsible for exposing your application within the cluster. The service can be a ClusterIP, NodePort, or LoadBalancer service. A LoadBalancer service is the most appropriate for this scenario because it allows for external access.

  2. Deploy an Ingress controller: An Ingress controller is responsible for creating and managing the load balancer that will route traffic to your application. GKE provides the GKE ingress controller as a built-in feature, so you don't need to deploy one manually.

  3. Create an Ingress resource: You can define your Ingress rules by creating an Ingress resource in your cluster. The Ingress resource specifies the rules for routing traffic to the services. You can specify the hostname and path that should be used to access the service.

  4. Create a Cloud Load Balancer: After you create the Ingress resource, GKE automatically provisions a Cloud Load Balancer that routes traffic to your service. You can configure the load balancer to use HTTP or HTTPS, and you can add SSL certificates to encrypt traffic.

In conclusion, to expose an application publicly behind a Cloud Load Balancing HTTP(S) load balancer in a GKE cluster, you should configure a GKE Ingress resource.