Ensure Kubernetes clusters are created with alias IP ranges enabled

Error: Kubernetes clusters are not created with alias IP ranges enabled

Bridgecrew Policy ID: GCP_KUBERNETES_15
Checkov Check ID: CKV_GCP_23
Severity: LOW

Kubernetes clusters are not created with alias IP ranges enabled

Description

In GKE, clusters can be set apart based on how they route traffic from one pod to another. A cluster that uses alias IP ranges is called a VPC-native cluster. A cluster that uses Google Cloud Routes is called a routes-based cluster.

We recommend you create Kubernetes clusters with alias IP ranges enabled. Alias IP ranges allow Pods to directly access hosted services without using a NAT gateway.

Fix - Buildtime

Terraform

resource "google_container_cluster" "primary" {
  name     = "my-gke-cluster"
  location = "us-central1"
  remove_default_node_pool = true
  initial_node_count       = 1
  ip_allocation_policy
  {
  }
}