GKE Module
Google Kubernetes Engine (GKE) is the most scalable and fully automated Kubernetes service. This module handles opinionated GKE cluster creation and configurations based on the Terraform module of GKE developed by Google.
This module deploy:
Public/Private GKE standard with beta functionalities.
Public/Private GCP Autopilot with beta functionalities.
By default, the GCP Kubernetes cluster is autopilot and private. Otherwise, you set:
private = falseand/orvar.autopilot = false.
Requirements
Name |
Version |
|---|---|
>=1.0 |
|
>= 4.75.0 |
|
>= 3.2.1 |
Providers
Name |
Version |
|---|---|
>= 4.75.0 |
|
>= 3.2.1 |
Modules
Name |
Source |
Version |
|---|---|---|
terraform-google-modules/kubernetes-engine/google//modules/beta-autopilot-public-cluster |
36.1.0 |
|
terraform-google-modules/kubernetes-engine/google//modules/beta-public-cluster |
36.1.0 |
|
terraform-google-modules/kubernetes-engine/google//modules/beta-autopilot-private-cluster |
36.1.0 |
|
terraform-google-modules/kubernetes-engine/google//modules/beta-private-cluster |
36.1.0 |
Resources
Name |
Type |
|---|---|
resource |
|
resource |
|
data source |
|
data source |
|
data source |
Inputs
Name |
Description |
Type |
Default |
Required |
|---|---|---|---|---|
Create additional firewall rules. |
|
|
no |
|
Create master_webhook firewall rules for ports defined in |
|
|
no |
|
Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). |
|
|
no |
|
The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format |
|
|
no |
|
Create autopilot GKE cluster. |
|
|
no |
|
(Beta) Enable CloudRun addon. |
|
|
no |
|
(Beta) Configure the Cloud Run load balancer type. External by default. Set to |
|
|
no |
|
Cluster autoscaling configuration. See more details. For |
object({ |
{ |
no |
|
The suffix used for all cluster service records. |
|
|
no |
|
Which in-cluster DNS provider should be used. PROVIDER_UNSPECIFIED (default) or PLATFORM_DEFAULT or CLOUD_DNS. |
|
|
no |
|
The scope of access to cluster DNS records. DNS_SCOPE_UNSPECIFIED (default) or CLUSTER_SCOPE or VPC_SCOPE. |
|
|
no |
|
The IP address range of the Kubernetes pods in this cluster. Default is an automatically assigned CIDR. |
|
|
no |
|
The GCE resource labels (a map of key/value pairs) to be applied to the cluster. |
|
|
no |
|
Available options include ENABLED, DISABLED, and SYSTEM_ONLY. |
|
|
no |
|
(Beta) Whether ConfigConnector is enabled for this cluster. |
|
|
no |
|
Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. |
|
|
no |
|
Application-layer Secrets Encryption settings. Valid values of state are: “ENCRYPTED”; “DECRYPTED”. |
list(object({ |
[ |
no |
|
The desired datapath provider for this cluster. By default, |
|
|
no |
|
The maximum number of pods to schedule per node. Note: For GKE versions earlier than 1.23.5-gke.1300, the limit is 110 Pods, otherwise the limit is 256 Pods. |
|
|
no |
|
(Beta) A toggle for Terraform and kubectl to connect to the master’s internal IP address during deployment. Used when |
|
|
no |
|
The description of the GKE cluster. |
|
|
no |
|
Whether to disable the default SNAT to support the private use of public IP addresses |
|
|
no |
|
Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. |
|
|
no |
|
The status of the NodeLocal DNSCache addon. |
|
|
no |
|
Enable BinAuthZ Admission controller. |
|
|
no |
|
An optional flag to enable confidential node config. |
|
|
no |
|
Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery. |
|
|
no |
|
Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. |
|
|
no |
|
Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network. |
|
|
no |
|
Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. |
|
|
no |
|
Enable L4 ILB Subsetting on the cluster. Used when |
|
|
no |
|
Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. |
|
|
no |
|
enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. Pod Security Policy was removed from GKE clusters with version >= 1.25.0.Used when |
|
|
no |
|
Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. |
|
|
no |
|
Enable Shielded Nodes features on all nodes in this cluster. |
|
|
no |
|
Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! Used when |
|
|
no |
|
Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it. |
|
|
no |
|
The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes. |
|
|
no |
|
List of TCP ports for admission/webhook controllers. Either flag |
|
[ |
no |
|
Priority rule for firewall rules. |
|
|
no |
|
The gateway api channel of this cluster. Accepted values are |
|
|
no |
|
Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. |
|
|
no |
|
Whether Backup for GKE agent is enabled for this cluster. |
|
|
no |
|
Grants created cluster-specific service account |
|
|
no |
|
Enable horizontal pod autoscaling addon. |
|
|
no |
|
Enable httpload balancer addon. |
|
|
no |
|
The workload pool to attach all Kubernetes service accounts to. (Default value of |
|
|
no |
|
The number of nodes to create in this cluster’s default node pool. |
|
|
no |
|
Whether to masquerade traffic to the link-local prefix (169.254.0.0/16). |
|
|
no |
|
The interval at which the agent attempts to sync its ConfigMap file from the disk. |
|
|
no |
|
The name of the secondary subnet ip range to use for Kubernetes pods. |
|
n/a |
yes |
|
The name of the secondary subnet range to use for Kubernetes services. |
|
n/a |
yes |
|
Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don’t automatically rotate and aren’t easily revocable. WARNING: changing this after cluster creation is destructive! |
|
|
no |
|
(Beta) Enable Istio addon. |
|
|
no |
|
(Beta) The authentication type between services in Istio. |
|
|
no |
|
(Beta) Whether KALM is enabled for this cluster. |
|
|
no |
|
Path to save the kubeconfig file. |
|
|
no |
|
The Kubernetes version of the masters. If set to ‘latest’ it will pull latest available version in the selected region. |
|
|
no |
|
List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. |
|
|
no |
|
The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none |
|
|
no |
|
Time window specified for recurring maintenance operations in RFC3339 format. |
|
|
no |
|
List of maintenance exclusions. A cluster can have up to three |
list(object({ |
|
no |
|
Frequency of the recurring maintenance window in RFC5545 format. |
|
|
no |
|
Time window specified for daily or recurring maintenance operations in RFC3339 format. |
|
|
no |
|
List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). |
list(object({ |
|
no |
|
Whether the cluster master is accessible globally (from any region) or only within the same region as the private endpoint. Used when |
|
|
no |
|
(Beta) The IP range in CIDR notation to use for the hosted master network. Used when |
|
|
no |
|
Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. |
|
|
no |
|
List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration. |
|
|
no |
|
The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none |
|
|
no |
|
The name of the GKE cluster. |
|
n/a |
yes |
|
The VPC network to host the GKE cluster in. |
|
n/a |
yes |
|
Enable network policy addon. |
|
|
no |
|
The network policy provider. See more about network policy. |
|
|
no |
|
The project ID of the shared VPC’s host (for shared vpc support). |
|
|
no |
|
(Optional, Beta) - List of network tags applied to auto-provisioned node pools. |
|
|
no |
|
Specifies how node metadata is exposed to the workload running on the node |
|
|
no |
|
List of maps containing node pools. |
|
[ |
no |
|
Map of maps containing node labels by node-pool name. |
|
{ |
no |
|
Map of maps containing linux node config sysctls by node-pool name. |
|
{ |
no |
|
Map of maps containing node metadata by node-pool name |
|
{ |
no |
|
Map of lists containing node oauth scopes by node-pool name. |
|
{ |
no |
|
Map of maps containing resource labels by node-pool name. |
|
{ |
no |
|
Map of lists containing node network tags by node-pool name. |
|
{ |
no |
|
Map of lists containing node taints by node-pool name. |
map(list(object({ |
{ |
no |
|
List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. |
|
[ |
no |
|
The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. |
|
|
no |
|
Create a private GKE cluster. |
|
|
no |
|
The region to host the cluster in (optional if zonal cluster / required if regional) |
|
|
no |
|
Whether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!) |
|
|
no |
|
Projects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and the |
|
|
no |
|
The release channel of this cluster. This allows you to opt for the alpha releases as part of the |
|
|
no |
|
Remove default node pool while setting up the cluster. |
|
|
no |
|
The ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export. |
|
|
no |
|
(Beta) Enable GKE Sandbox (Do not forget to set |
|
|
no |
|
The service account to run nodes as if not overridden in |
|
|
no |
|
The name of the service account that will be created if create_service_account is true. If you wish to use an existing service account, use service_account variable. |
|
|
no |
|
Whether external ips specified by a service will be allowed in this cluster. |
|
|
no |
|
The log_config for shadow firewall rules. You can set this variable to |
object({ |
{ |
no |
|
The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. |
|
|
no |
|
Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server. Not used for Autopilot GKE. |
|
|
no |
|
The subnetwork to host the GKE cluster in. |
|
n/a |
yes |
|
CIDR of the subnetwork of nodes in GKE cluster. |
|
n/a |
yes |
|
Timeout for cluster operations. |
|
|
no |
|
If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf. Not used for Autopilot GKE. |
|
|
no |
|
List of maps containing Windows node pools. |
|
|
no |
|
(beta) Worload config audit mode. |
|
|
no |
|
(beta) Vulnerability mode. |
|
|
no |
|
The zones to host the cluster in (optional if regional cluster / required if zonal) |
|
|
no |
Outputs
Name |
Description |
|---|---|
Autopilot GKE cluster. |
|
Cluster ca certificate (base64 encoded). |
|
Whether CloudRun enabled. |
|
GKE cluster ID. |
|
Whether DNS Cache enabled |
|
Cluster endpoint. |
|
The gateway api channel of this cluster. |
|
Whether horizontal pod autoscaling enabled. |
|
Whether http load balancing enabled. |
|
Workload Identity pool. |
|
Whether Identity Service is enabled. |
|
List of GKE generated instance groups. |
|
Whether intra-node visibility is enabled. |
|
Whether Istio is enabled. |
|
Path where the kubeconfig file is saved. |
|
Cluster location (region if regional cluster, zone if zonal cluster). |
|
Logging service used. |
|
Networks from which access to master is permitted. |
|
The IP range in CIDR notation used for the hosted master network. |
|
Current master kubernetes version. |
|
Minimum master kubernetes version. |
|
Monitoring service used. |
|
GKE cluster name. |
|
Whether network policy enabled. |
|
List of node pools names. |
|
Node pool versions by node pool name. |
|
The name of the peering between this cluster and the Google owned VPC. |
|
Whether pod security policy is enabled. |
|
Private GKE cluster. |
|
Cluster region. |
|
The release channel of this cluster. |
|
The service account to default running nodes as if not overridden in |
|
The IP range in CIDR notation used for the TPUs |
|
GKE cluster type (regional / zonal). |
|
Whether vertical pod autoscaling enabled. |
|
List of zones in which the cluster resides |