Ingress configuration

Overview

This page provides a comprehensive guide for configuring Kubernetes Ingress on Google Cloud. This page details how to use FrontendConfig custom resources to manage frontend features like SSL policies and HTTPS redirects, and BackendConfig custom resources to fine-tune backend settings such as service timeouts, Cloud CDN, Google Cloud Armor security policies, and Identity-Aware Proxy (IAP).

For a high-level conceptual overview of these capabilities and the underlying architecture of GKE Ingress, see:

This page is for Networking specialists who design and architect the network for their organization and install, configure, and support network equipment. To learn more about common roles and example tasks that we reference in Google Cloud content, see Common GKE user roles and tasks.

Feature comparison

The following table provides a list of supported features for Ingress on Google Cloud. The availability of the feature, General availability (GA) or Beta is also indicated.

Ingress class External Ingress Internal Ingress Multi Cluster Ingress
Ingress controller Google-hosted Ingress controller
Google Cloud load balancer type External HTTP(S) LB Internal HTTP(S) LB External HTTP(S) LB
Cluster scope Single cluster Single cluster Multi-cluster
Load balancer scope Global Regional Global
Environment support GKE GKE GKE
Shared VPC support GA GA GA
Service annotations
Container-native Load Balancing (NEGs) GA GA GA
HTTPS from load balancer to backends GA GA GA
HTTP/2 GA GA
TLS Only
GA
Ingress annotations
Static IP addresses GA GA GA
Kubernetes Secrets-based certificates GA GA GA
Self-managed SSL certificates GA GA GA
Google-managed SSL certificates GA GA
FrontendConfig
SSL policy GA GA with Gateway GA
HTTP-to-HTTPS redirect GA
1.17.13-gke.2600+GA
GA
BackendConfig
Backend service timeout GA GA GA
Cloud CDN GA GA
Connection draining timeout GA GA GA
Custom load balancer health check configuration GA GA GA
Google Cloud Armor security policy GA
1.19.10-gke.700G
GA
HTTP access logging configuration GA GA GA
Identity-Aware Proxy (IAP) GA GA GA
Session affinity GA GA GA
User-defined request headers GA GA
Custom response headers GA
1.25-gke+G

BThis feature is available in beta starting from the specified version. Features without a version listed are supported for all available GKE versions.

GThis feature is supported as GA starting from the specified version.

Configuring Ingress using the default controller

You cannot manually configure LoadBalancer features using the Google Cloud SDK or the Google Cloud console. You must use BackendConfig or FrontendConfig Kubernetes resources.

When creating an Ingress using the default controller, you can choose the type of load balancer (an external Application Load Balancer or an internal Application Load Balancer) by using an annotation on the Ingress object. You can choose whether GKE creates zonal NEGs or if it uses instance groups by using an annotation on each Service object.

FrontendConfig and BackendConfig custom resource definitions (CRDs) allow you to further customize the load balancer. These CRDs allow you to define additional load balancer features hierarchically, in a more structured way than annotations. To use Ingress (and these CRDs), you must have the HTTP load balancing add-on enabled. GKE clusters have HTTP load balancing enabled by default; you must not disable it.

FrontendConfigs are referenced in an Ingress object and can only be used with external Ingresses. BackendConfigs are referenced by a Service object. The same CRDs can be referenced by multiple Service or Ingress objects for configuration consistency. The FrontendConfig and BackendConfig CRDs share the same lifecycle as their corresponding Ingress and Service resources and they are often deployed together.

The following diagram illustrates how:

  • An annotation on an Ingress or MultiClusterIngress object references a FrontendConfig CRD. The FrontendConfig CRD references a Google Cloud SSL Policy.

  • An annotation on a Service or MultiClusterService object references a BackendConfig CRD. The BackendConfig CRD specifies custom settings for the corresponding backend service's health check.

BackendConfig and FrontendConfig overview
Figure: BackendConfig and FrontendConfig overview

Associating FrontendConfig with your Ingress

FrontendConfig can only be used with External Ingresses.

You can associate a FrontendConfig with an Ingress or a MultiClusterIngress.

Ingress

Use the networking.gke.io/v1beta1.FrontendConfig annotation:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    networking.gke.io/v1beta1.FrontendConfig: "FRONTENDCONFIG_NAME"
...

Replace FRONTENDCONFIG_NAME with the name of your FrontendConfig.

MultiClusterIngress

Use the networking.gke.io/frontend-config annotation:

apiVersion: networking.gke.io/v1
kind: MultiClusterIngress
metadata:
  annotations:
    networking.gke.io/frontend-config: "FRONTENDCONFIG_NAME"
...

Replace FRONTENDCONFIG_NAME with the name of your FrontendConfig.

Associating BackendConfig with your Ingress

You can use the cloud.google.com/backend-config or beta.cloud.google.com/backend-config annotation to specify the name of a BackendConfig.

Same BackendConfig for all Service ports

To use the same BackendConfig for all ports, use the default key in the annotation. The Ingress controller uses the same BackendConfig each time it creates a load balancer backend service to reference one of the Service's ports.

You can use the default key for both Ingress and MultiClusterIngress resources.

apiVersion: v1
kind: Service
metadata:
  annotations:
    cloud.google.com/backend-config: '{"default": "my-backendconfig"}'
...

Unique BackendConfig per Service port

For both Ingress and MultiClusterIngress, you can specify a custom BackendConfig for one or more ports using a key that matches the port's name or number. The Ingress controller uses the specific BackendConfig when it creates a load balancer backend service for a referenced Service port.