GKE - How to serve HTTPS via the L7 load balancer?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction to GKE and Load Balancers
Google Kubernetes Engine (GKE) is a managed service offered by Google Cloud Platform (GCP) that allows you to run Kubernetes clusters within the Google infrastructure. One of the critical aspects of deploying applications on GKE is serving traffic securely over HTTPS, typically achieved using load balancers.
This article will guide you through the process of serving HTTPS content via the Layer 7 (L7) load balancer in GKE. We'll delve into the technical workings, configurations, and examples to help you understand and implement it.
What is a Layer 7 Load Balancer?
Layer 7 load balancers operate at the application layer of the OSI model. They can make intelligent routing decisions based on the content of the HTTP request. In the context of GKE, a Layer 7 load balancer is an HTTP(S) load balancer that can distribute incoming HTTPS traffic across multiple backend instances.
Why Use an L7 Load Balancer?
- Advanced Routing: Direct traffic based on URL paths and headers.
- SSL Termination: Manage SSL certificates centrally, simplifying the deployment of HTTPS.
- Global Load Balancing: Efficiently distribute traffic to multiple regions.
- Improved Security: Add another layer of protection through web application firewall integrations and DDoS protection.
Setting Up HTTPS on GKE with L7 Load Balancer
Setting up HTTPS on GKE involves several steps, each integrating various Google Cloud services. Here's a step-by-step on how to accomplish this:
1. Prepare Your GKE Cluster
Before configuring a load balancer, ensure your GKE cluster and workloads are properly set up and running. Deploy your Kubernetes application with appropriate services and workloads.
2. Provision a Managed SSL Certificate
- Create a ManagedCertificate Resource: Use the Kubernetes `ManagedCertificate` CRD (Custom Resource Definition) to define the domains for which you need HTTPS certificates.
- example.com
- host: example.com
- path: /
- Enable Cloud Armor: It offers DDoS protection and additional security policies.
- IAM Roles and Policies: Secure your cluster's operations by providing least privileged access.
Related reading
- GKE autopilot has scaled up my container resources contary to resource requests
- GKE cluster suddenly not autoscaling nodepool
- GKE does not scale to/from 0 when autoscaling enabled
- GKE Google Managed Certificate with DNS authorization
- GKE node with modprobe
- GKE right way to mount same PV on multiple pods
- GKE ingress controller annotations for proxy body size, buffer size and sever snippets
- GlusterFS, how to server files using http or https?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.