Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pexip/terraform-google-kubernetes-engine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This module handles opinionated Google Cloud Platform Kubernetes Engine cluster creation and configuration with Node Pools, IP MASQ, Network Policy, etc.The resources/services/activations/deletions that this module will create/trigger are:

  • Create a GKE cluster with the provided addons
  • Create GKE Node Pool(s) with provided configuration and attach to cluster
  • Replace the default kube-dns configmap ifstub_domains are provided
  • Activate network policy ifnetwork_policy is true
  • Addip-masq-agent configmap with providednon_masquerade_cidrs ifconfigure_ip_masq is true

Sub modules are provided for creating private clusters, beta private clusters, and beta public clusters as well. Beta sub modules allow for the use of various GKE beta features. See the modules directory for the various sub modules.

Compatibility

This module is meant for use with Terraform 1.3+ and tested using Terraform 1.10+.If you find incompatibilities using Terraform>=1.3, please open an issue.

If you haven'tupgraded to 1.3 and need a Terraform0.13.x-compatible version of this module, the last released versionintended for Terraform 0.13.x is [27.0.0].

If you haven'tupgraded to 0.13 and need a Terraform0.12.x-compatible version of this module, the last released versionintended for Terraform 0.12.x is12.3.0.

Usage

There are multiple examples included in theexamples folder but simple usage is as follows:

# google_client_config and kubernetes provider must be explicitly specified like the following.data"google_client_config""default" {}provider"kubernetes" {host="https://${module.gke.endpoint}"token=data.google_client_config.default.access_tokencluster_ca_certificate=base64decode(module.gke.ca_certificate)}module"gke" {source="terraform-google-modules/kubernetes-engine/google"project_id="<PROJECT ID>"name="gke-test-1"region="us-central1"zones=["us-central1-a","us-central1-b","us-central1-f"]network="vpc-01"subnetwork="us-central1-01"ip_range_pods="us-central1-01-gke-01-pods"ip_range_services="us-central1-01-gke-01-services"http_load_balancing=falsenetwork_policy=falsehorizontal_pod_autoscaling=truefilestore_csi_driver=falsedns_cache=falsenode_pools=[    {      name="default-node-pool"      machine_type="e2-medium"      node_locations="us-central1-b,us-central1-c"      min_count=1      max_count=100      local_ssd_count=0      spot=false      disk_size_gb=100      disk_type="pd-standard"      image_type="COS_CONTAINERD"      enable_gcfs=false      enable_gvnic=false      logging_variant="DEFAULT"      auto_repair=true      auto_upgrade=true      service_account="project-service-account@<PROJECT ID>.iam.gserviceaccount.com"      preemptible=false      initial_node_count=80      accelerator_count=1      accelerator_type="nvidia-l4"      gpu_driver_version="LATEST"      gpu_sharing_strategy="TIME_SHARING"      max_shared_clients_per_gpu=2    },  ]node_pools_oauth_scopes={    all= ["https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring",    ]  }node_pools_labels={    all= {}    default-node-pool= {      default-node-pool=true    }  }node_pools_metadata={    all= {}    default-node-pool= {      node-pool-metadata-custom-value="my-node-pool"    }  }node_pools_taints={    all= []    default-node-pool= [      {        key="default-node-pool"        value=true        effect="PREFER_NO_SCHEDULE"      },    ]  }node_pools_tags={    all= []    default-node-pool= ["default-node-pool",    ]  }}

Then perform the following commands on the root folder:

  • terraform init to get the plugins
  • terraform plan to see the infrastructure plan
  • terraform apply to apply the infrastructure build
  • terraform destroy to destroy the built infrastructure

Inputs

NameDescriptionTypeDefaultRequired
add_cluster_firewall_rulesCreate additional firewall rulesboolfalseno
add_master_webhook_firewall_rulesCreate master_webhook firewall rules for ports defined infirewall_inbound_portsboolfalseno
add_shadow_firewall_rulesCreate GKE shadow firewall (the same as default firewall rules with firewall logs enabled).boolfalseno
additional_ip_range_podsList ofnames of the additional secondary subnet ip ranges to use for podslist(string)[]no
additional_ip_ranges_configthe configuration for individual additional subnetworks attached to the clusterlist(object({ subnetwork = string, pod_ipv4_range_names = list(string) }))[]no
additive_vpc_scope_dns_domainThis will enable Cloud DNS additive VPC scope. Must provide a domain name that is unique within the VPC. For this to work cluster_dns =CLOUD_DNS and cluster_dns_scope =CLUSTER_SCOPE must both be set as well.string""no
anonymous_authentication_config_modeAllows users to restrict or enable anonymous access to the cluster. Valid values areENABLED andLIMITED.stringnullno
authenticator_security_groupThe name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in formatgke-security-groups@yourdomain.comstringnullno
boot_disk_kms_keyThe Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool, if not overridden innode_pools. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. For more information about protecting resources with Cloud KMS Keys please see:https://cloud.google.com/compute/docs/disks/customer-managed-encryptionstringnullno
cluster_autoscalingCluster autoscaling configuration. Seemore details
object({
enabled = bool
autoscaling_profile = string
min_cpu_cores = optional(number)
max_cpu_cores = optional(number)
min_memory_gb = optional(number)
max_memory_gb = optional(number)
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
auto_repair = bool
auto_upgrade = bool
disk_size = optional(number)
disk_type = optional(string)
image_type = optional(string)
strategy = optional(string)
max_surge = optional(number)
max_unavailable = optional(number)
node_pool_soak_duration = optional(string)
batch_soak_duration = optional(string)
batch_percentage = optional(number)
batch_node_count = optional(number)
enable_secure_boot = optional(bool, false)
enable_integrity_monitoring = optional(bool, true)
})
{
"auto_repair": true,
"auto_upgrade": true,
"autoscaling_profile": "BALANCED",
"disk_size": 100,
"disk_type": "pd-standard",
"enable_integrity_monitoring": true,
"enable_secure_boot": false,
"enabled": false,
"gpu_resources": [],
"image_type": "COS_CONTAINERD",
"max_cpu_cores": 0,
"max_memory_gb": 0,
"min_cpu_cores": 0,
"min_memory_gb": 0
}
no
cluster_dns_domainThe suffix used for all cluster service records.string""no
cluster_dns_providerWhich in-cluster DNS provider should be used. PROVIDER_UNSPECIFIED (default) or PLATFORM_DEFAULT or CLOUD_DNS.string"PROVIDER_UNSPECIFIED"no
cluster_dns_scopeThe scope of access to cluster DNS records. DNS_SCOPE_UNSPECIFIED (default) or CLUSTER_SCOPE or VPC_SCOPE.string"DNS_SCOPE_UNSPECIFIED"no
cluster_ipv4_cidrThe IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR.stringnullno
cluster_resource_labelsThe GCE resource labels (a map of key/value pairs) to be applied to the clustermap(string){}no
config_connectorWhether ConfigConnector is enabled for this cluster.boolfalseno
configure_ip_masqEnables 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.boolfalseno
create_service_accountDefines if service account specified to run nodes should be created.booltrueno
database_encryptionApplication-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key.list(object({ state = string, key_name = string }))
[
{
"key_name": "",
"state": "DECRYPTED"
}
]
no
datapath_providerThe desired datapath provider for this cluster. By default,DATAPATH_PROVIDER_UNSPECIFIED enables the IPTables-based kube-proxy implementation.ADVANCED_DATAPATH enables Dataplane-V2 feature.string"DATAPATH_PROVIDER_UNSPECIFIED"no
default_compute_class_enabledEnable Spot VMs as the default compute class for Node Auto-Provisioningboolnullno
default_max_pods_per_nodeThe maximum number of pods to schedule per nodenumber110no
deletion_protectionWhether or not to allow Terraform to destroy the cluster.booltrueno
descriptionThe description of the clusterstring""no
disable_default_snatWhether to disable the default SNAT to support the private use of public IP addressesboolfalseno
disable_l4_lb_firewall_reconciliationDisable L4 Load Balancer firewall reconciliationboolnullno
disable_legacy_metadata_endpointsDisable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated.booltrueno
dns_allow_external_traffic(Optional) Controls whether external traffic is allowed over the dns endpoint.boolnullno
dns_cacheThe status of the NodeLocal DNSCache addon.boolfalseno
enable_binary_authorizationEnable BinAuthZ Admission controllerboolfalseno
enable_cilium_clusterwide_network_policyEnable Cilium Cluster Wide Network Policies on the clusterboolfalseno
enable_confidential_nodesAn optional flag to enable confidential node config.boolfalseno
enable_cost_allocationEnables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQueryboolfalseno
enable_default_node_pools_metadataWhether to enable the default node pools metadata key-value pairs such ascluster_name andnode_poolbooltrueno
enable_fqdn_network_policyEnable FQDN Network Policies on the clusterboolnullno
enable_gcfsEnable image streaming on cluster level.boolfalseno
enable_identity_service(Optional) Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. NOTE: Starting on July 1, 2025, new Google Cloud organizations that you create won't support Identity Service for GKE.boolfalseno
enable_intranode_visibilityWhether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC networkboolfalseno
enable_k8s_beta_apis(Optional) - List of Kubernetes Beta APIs to enable in cluster.list(string)[]no
enable_kubernetes_alphaWhether 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.boolfalseno
enable_l4_ilb_subsettingEnable L4 ILB Subsetting on the clusterboolfalseno
enable_legacy_lustre_portSet it to true for GKE cluster runs a version earlier than 1.33.2-gke.4780000. Allows the Lustre CSI driver to initialize LNet (the virtual network layer for Lustre kernel module) using port 6988. This flag is required to workaround a port conflict with the gke-metadata-server on GKE nodesboolfalseno
enable_mesh_certificatesControls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity.boolfalseno
enable_multi_networkingWhether multi-networking is enabled for this clusterboolnullno
enable_network_egress_exportWhether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic.boolfalseno
enable_resource_consumption_exportWhether 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.booltrueno
enable_secret_manager_addonEnable the Secret Manager add-on for this clusterboolfalseno
enable_shielded_nodesEnable Shielded Nodes features on all nodes in this clusterbooltrueno
enable_tpuEnable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive!boolfalseno
enable_vertical_pod_autoscalingVertical Pod Autoscaling automatically adjusts the resources of pods controlled by itboolfalseno
enterprise_config(Optional) Enable or disable GKE enterprise. Valid values are STANDARD and ENTERPRISE.stringnullno
filestore_csi_driverThe status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumesboolfalseno
firewall_inbound_portsList of TCP ports for admission/webhook controllers. Either flagadd_master_webhook_firewall_rules oradd_cluster_firewall_rules (also adds egress rules) must be set totrue for inbound-ports firewall rules to be applied.list(string)
[
"8443",
"9443",
"15017"
]
no
firewall_priorityPriority rule for firewall rulesnumber1000no
fleet_project(Optional) Register the cluster with the fleet in this project.stringnullno
gateway_api_channelThe gateway api channel of this cluster. Accepted values areCHANNEL_STANDARD andCHANNEL_DISABLED.stringnullno
gce_pd_csi_driverWhether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver.booltrueno
gcp_public_cidrs_access_enabledAllow access through Google Cloud public IP addressesboolnullno
gcs_fuse_csi_driverWhether GCE FUSE CSI driver is enabled for this cluster.boolfalseno
gke_auto_upgrade_config_patch_modeThe selected auto-upgrade patch type. Accepted values are:ACCELERATED: Upgrades to the latest available patch version in a given minor and release channel.stringnullno
gke_backup_agent_configWhether Backup for GKE agent is enabled for this cluster.boolfalseno
grant_registry_accessGrants created cluster-specific service account storage.objectViewer and artifactregistry.reader roles.boolfalseno
horizontal_pod_autoscalingEnable horizontal pod autoscaling addonbooltrueno
hpa_profileEnable the Horizontal Pod Autoscaling profile for this cluster. Values are "NONE" and "PERFORMANCE".string""no
http_load_balancingEnable httpload balancer addonbooltrueno
identity_namespaceThe workload pool to attach all Kubernetes service accounts to. (Default value ofenabled automatically sets project-based pool[project_id].svc.id.goog)string"enabled"no
in_transit_encryption_configDefines the config of in-transit encryption. Valid values areIN_TRANSIT_ENCRYPTION_DISABLED andIN_TRANSIT_ENCRYPTION_INTER_NODE_TRANSPARENT.stringnullno
initial_node_countThe number of nodes to create in this cluster's default node pool.number0no
insecure_kubelet_readonly_port_enabledWhether or not to setinsecure_kubelet_readonly_port_enabled for node pool defaults and autopilot clusters. Note: this can be set at the node pool level separately withinnode_pools.boolnullno
ip_endpoints_enabled(Optional) Controls whether to allow direct IP access. Defaults totrue.boolnullno
ip_masq_link_localWhether to masquerade traffic to the link-local prefix (169.254.0.0/16).boolfalseno
ip_masq_resync_intervalThe interval at which the agent attempts to sync its ConfigMap file from the disk.string"60s"no
ip_range_podsThename of the secondary subnet ip range to use for podsstringn/ayes
ip_range_servicesThename of the secondary subnet range to use for services. If not provided, the default34.118.224.0/20 range will be used.stringnullno
issue_client_certificateIssues 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!boolfalseno
kubernetes_versionThe Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region.string"latest"no
logging_enabled_componentsList of services to monitor: SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, KCP_HPA, SCHEDULER, and WORKLOADS. Empty list is default GKE configuration.list(string)[]no
logging_serviceThe logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and nonestring"logging.googleapis.com/kubernetes"no
logging_variant(Optional) The type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX_THROUGHPUT.stringnullno
lustre_csi_driverThe status of the Lustre CSI driver addon, which allows the usage of a Lustre instances as volumesboolnullno
maintenance_end_timeTime window specified for recurring maintenance operations in RFC3339 formatstring""no
maintenance_exclusionsList of maintenance exclusions. A cluster can have up to threelist(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))[]no
maintenance_recurrenceFrequency of the recurring maintenance window in RFC5545 format.string""no
maintenance_start_timeTime window specified for daily or recurring maintenance operations in RFC3339 formatstring"05:00"no
master_authorized_networksList of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists).list(object({ cidr_block = string, display_name = string }))[]no
monitoring_enable_managed_prometheusConfiguration for Managed Service for Prometheus. Whether or not the managed collection is enabled.boolnullno
monitoring_enable_observability_metricsWhether or not the advanced datapath metrics are enabled.boolfalseno
monitoring_enable_observability_relayWhether or not the advanced datapath relay is enabled.boolfalseno
monitoring_enabled_componentsList of services to monitor: SYSTEM_COMPONENTS, APISERVER, SCHEDULER, CONTROLLER_MANAGER, STORAGE, HPA, POD, DAEMONSET, DEPLOYMENT, STATEFULSET, KUBELET, CADVISOR, DCGM, and JOBSET. In beta provider, WORKLOADS is supported on top of those 12 values. (WORKLOADS is deprecated and removed in GKE 1.24.) KUBELET and CADVISOR are only supported in GKE 1.29.3-gke.1093000 and above. JOBSET is only supported in GKE 1.32.1-gke.1357001 and above. Empty list is default GKE configuration.list(string)[]no
monitoring_metric_writer_roleThe monitoring metrics writer role to assign to the GKE node service accountstring"roles/monitoring.metricWriter"no
monitoring_serviceThe 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 nonestring"monitoring.googleapis.com/kubernetes"no
nameThe name of the cluster (required)stringn/ayes
networkThe VPC network to host the cluster in (required)stringn/ayes
network_policyEnable network policy addonboolfalseno
network_policy_providerThe network policy provider.string"CALICO"no
network_project_idThe project ID of the shared VPC's host (for shared vpc support)string""no
network_tags(Optional) - List of network tags applied to autopilot and auto-provisioned node pools.list(string)[]no
node_metadataSpecifies how node metadata is exposed to the workload running on the nodestring"GKE_METADATA"no
node_poolsList of maps containing node poolslist(map(any))
[
{
"name": "default-node-pool"
}
]
no
node_pools_cgroup_modeMap of strings containing cgroup node config by node-pool namemap(string)
{
"all": "",
"default-node-pool": ""
}
no
node_pools_hugepage_size_1gMap of strings containing hugepage size 1g config by node-pool namemap(string)
{
"all": "",
"default-node-pool": ""
}
no
node_pools_hugepage_size_2mMap of strings containing hugepage size 2m node config by node-pool namemap(string)
{
"all": "",
"default-node-pool": ""
}
no
node_pools_labelsMap of maps containing node labels by node-pool namemap(map(string))
{
"all": {},
"default-node-pool": {}
}
no
node_pools_linux_node_configs_sysctlsMap of maps containing linux node config sysctls by node-pool namemap(map(string))
{
"all": {},
"default-node-pool": {}
}
no
node_pools_metadataMap of maps containing node metadata by node-pool namemap(map(string))
{
"all": {},
"default-node-pool": {}
}
no
node_pools_oauth_scopesMap of lists containing node oauth scopes by node-pool namemap(list(string))
{
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
no
node_pools_resource_labelsMap of maps containing resource labels by node-pool namemap(map(string))
{
"all": {},
"default-node-pool": {}
}
no
node_pools_resource_manager_tagsMap of maps containing resource manager tags by node-pool namemap(map(string))
{
"all": {},
"default-node-pool": {}
}
no
node_pools_tagsMap of lists containing node network tags by node-pool namemap(list(string))
{
"all": [],
"default-node-pool": []
}
no
node_pools_taintsMap of lists containing node taints by node-pool namemap(list(object({ key = string, value = string, effect = string })))
{
"all": [],
"default-node-pool": []
}
no
non_masquerade_cidrsList of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading.list(string)
[
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
no
notification_config_topicThe desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}.string""no
notification_filter_event_typeChoose what type of notifications you want to receive. If no filters are applied, you'll receive all notification types. Can be used to filter what notifications are sent. Accepted values are UPGRADE_AVAILABLE_EVENT, UPGRADE_EVENT, and SECURITY_BULLETIN_EVENT.list(string)[]no
parallelstore_csi_driverWhether the Parallelstore CSI driver Addon is enabled for this cluster.boolnullno
project_idThe project ID to host the cluster in (required)stringn/ayes
ray_operator_configThe Ray Operator Addon configuration for this cluster.
object({
enabled = bool
logging_enabled = optional(bool, false)
monitoring_enabled = optional(bool, false)
})
{
"enabled": false,
"logging_enabled": false,
"monitoring_enabled": false
}
no
rbac_binding_configRBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
object({
enable_insecure_binding_system_unauthenticated = optional(bool, null)
enable_insecure_binding_system_authenticated = optional(bool, null)
})
{
"enable_insecure_binding_system_authenticated": null,
"enable_insecure_binding_system_unauthenticated": null
}
no
regionThe region to host the cluster in (optional if zonal cluster / required if regional)stringnullno
regionalWhether is a regional cluster (zonal cluster if set false. WARNING: changing this after cluster creation is destructive!)booltrueno
registry_project_idsProjects holding Google Container Registries. If empty, we use the cluster project. If a service account is created and thegrant_registry_access variable is set totrue, thestorage.objectViewer andartifactregsitry.reader roles are assigned on these projects.list(string)[]no
release_channelThe release channel of this cluster. Accepted values areUNSPECIFIED,RAPID,REGULAR andSTABLE. Defaults toREGULAR.string"REGULAR"no
remove_default_node_poolRemove default node pool while setting up the clusterboolfalseno
resource_manager_tags(Optional) - List of resource manager tags applied to autopilot and auto-provisioned node pools. A maximum of 5 tags can be specified. Tags must be in one of these formats: "tagKeys/{tag_key_id}"="tagValues/{tag_value_id}", "{org_id}/{tag_key_name}"="{tag_value_name}", "{project_id}/{tag_key_name}"="{tag_value_name}".map(string){}no
resource_usage_export_dataset_idThe ID of a BigQuery Dataset for using BigQuery as the destination of resource usage export.string""no
security_posture_modeSecurity posture mode. Accepted values areDISABLED andBASIC. Defaults toDISABLED.string"DISABLED"no
security_posture_vulnerability_modeSecurity posture vulnerability mode. Accepted values areVULNERABILITY_DISABLED,VULNERABILITY_BASIC, andVULNERABILITY_ENTERPRISE. Defaults toVULNERABILITY_DISABLED.string"VULNERABILITY_DISABLED"no
service_accountThe service account to run nodes as if not overridden innode_pools. The create_service_account variable default value (true) will cause a cluster-specific service account to be created. This service account should already exists and it will be used by the node pools. If you wish to only override the service account name, you can use service_account_name variable.string""no
service_account_nameThe 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.string""no
service_external_ipsWhether external ips specified by a service will be allowed in this clusterboolfalseno
shadow_firewall_rules_log_configThe log_config for shadow firewall rules. You can set this variable tonull to disable logging.
object({
metadata = string
})
{
"metadata": "INCLUDE_ALL_METADATA"
}
no
shadow_firewall_rules_priorityThe firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000.number999no
stack_typeThe stack type to use for this cluster. EitherIPV4 orIPV4_IPV6. Defaults toIPV4.string"IPV4"no
stateful_haWhether the Stateful HA Addon is enabled for this cluster.boolfalseno
stub_domainsMap of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS servermap(list(string)){}no
subnetworkThe subnetwork to host the cluster in (required)stringn/ayes
timeoutsTimeout for cluster operations.map(string){}no
total_egress_bandwidth_tierSpecifies the total network bandwidth tier for NodePools in the cluster. Valid values areTIER_UNSPECIFIED andTIER_1. Defaults toTIER_UNSPECIFIED.stringnullno
upstream_nameserversIf specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conflist(string)[]no
windows_node_poolsList of maps containing Windows node poolslist(map(string))[]no
zonesThe zones to host the cluster in (optional if regional cluster / required if zonal)list(string)[]no

Outputs

NameDescription
ca_certificateCluster ca certificate (base64 encoded)
cluster_idCluster ID
dns_cache_enabledWhether DNS Cache enabled
endpointCluster endpoint
endpoint_dnsCluster endpoint DNS
fleet_membershipFleet membership (if registered)
gateway_api_channelThe gateway api channel of this cluster.
horizontal_pod_autoscaling_enabledWhether horizontal pod autoscaling enabled
http_load_balancing_enabledWhether http load balancing enabled
identity_namespaceWorkload Identity pool
identity_service_enabledWhether Identity Service is enabled
instance_group_urlsList of GKE generated instance groups
intranode_visibility_enabledWhether intra-node visibility is enabled
locationCluster location (region if regional cluster, zone if zonal cluster)
logging_serviceLogging service used
master_authorized_networks_configNetworks from which access to master is permitted
master_versionCurrent master kubernetes version
mesh_certificates_configMesh certificates configuration
min_master_versionMinimum master kubernetes version
monitoring_serviceMonitoring service used
nameCluster name
network_policy_enabledWhether network policy enabled
node_pools_namesList of node pools names
node_pools_versionsNode pool versions by node pool name
regionCluster region
release_channelThe release channel of this cluster
secret_manager_addon_enabledWhether Secret Manager add-on is enabled
service_accountThe service account to default running nodes as if not overridden innode_pools.
tpu_ipv4_cidr_blockThe IP range in CIDR notation used for the TPUs
typeCluster type (regional / zonal)
vertical_pod_autoscaling_enabledWhether vertical pod autoscaling enabled
zonesList of zones in which the cluster resides

node_pools variable

Use this variable for provisioning linux based node pools. For Windows based node pools usewindows_node_pools

The node_pools variable takes the following parameters:

NameDescriptionDefaultRequirement
accelerator_countThe number of the guest accelerator cards exposed to this instance0Optional
accelerator_typeThe accelerator type resource to expose to the instance" "Optional
auto_repairWhether the nodes will be automatically repairedtrueOptional
autoscalingConfiguration required by cluster autoscaler to adjust the size of the node pool to the current cluster usagetrueOptional
auto_upgradeWhether the nodes will be automatically upgradedtrue (if cluster is regional)Optional
storage_poolsThe list of Storage Pools where boot disks are provisioned.Optional
boot_disk_kms_keyThe Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]." "Optional
cpu_manager_policyThe CPU manager policy on the node. One of "none" or "static"."static"Optional
cpu_cfs_quotaEnforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignorednullOptional
cpu_cfs_quota_periodThe CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocatednullOptional
pod_pids_limitControls the maximum number of processes allowed to run in a pod. The value must be greater than or equal to 1024 and less than 4194304.nullOptional
container_log_max_sizeDefines the maximum size of the container log file before it is rotated.nullOptional
container_log_max_filesDefines the maximum number of container log files that can be present for a container.nullOptional
image_gc_low_threshold_percentDefines the percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to.nullOptional
image_gc_high_threshold_percentDefines the percent of disk usage after which image garbage collection is always run.nullOptional
image_minimum_gc_ageDefines the minimum age for an unused image before it is garbage collected.nullOptional
image_maximum_gc_ageDefines the maximum age an image can be unused before it is garbage collected.nullOptional
allowed_unsafe_sysctlsDefines a comma-separated allowlist of unsafe sysctls or sysctl patterns which can be set on the Pods. This should be passed as comma separated string.nullOptional
enable_confidential_nodesAn optional flag to enable confidential node config.falseOptional
disk_size_gbSize of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB100Optional
disk_typeType of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd')pd-standardOptional
effectEffect for the taintRequired
enable_fast_socketEnable the NCCL Fast Socket feature.enable_gvnic must also be enabled.nullOptional
enable_gcfsGoogle Container File System (gcfs) has to be enabled for image streaming to be active. Needs image_type to be set to COS_CONTAINERD.falseOptional
enable_gvnicgVNIC (GVE) is an alternative to the virtIO-based ethernet driver. Needs a Container-Optimized OS node image.falseOptional
enable_integrity_monitoringEnables monitoring and attestation of the boot integrity of the instance. The attestation is performed against the integrity policy baseline. This baseline is initially derived from the implicitly trusted boot image when the instance is created.trueOptional
enable_secure_bootSecure Boot helps ensure that the system only runs authentic software by verifying the digital signature of all boot components, and halting the boot process if signature verification fails.falseOptional
gpu_driver_versionMode for how the GPU driver is installednullOptional
gpu_partition_sizeSize of partitions to create on the GPUnullOptional
image_typeThe image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node poolCOS_CONTAINERDOptional
initial_node_countThe initial number of nodes for the pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Changing this will force recreation of the resource. Defaults to the value of min_count" "Optional
insecure_kubelet_readonly_port_enabled(boolean) Whether or not to enable the insecure Kubelet readonly port.nullOptional
keyThe key required for the taintRequired
logging_variantThe type of logging agent that is deployed by default for newly created node pools in the cluster. Valid values include DEFAULT and MAX_THROUGHPUT.DEFAULTOptional
local_ssd_countThe amount of local SSD disks that will be attached to each cluster node and may be used as ahostpath volume or alocal PersistentVolume.0Optional
local_ssd_ephemeral_storage_countThe amount of local SSD disks that will be attached to each cluster node and assigned as scratch space as anemptyDir volume. If unspecified, ephemeral storage is backed by the cluster node boot disk.0Optional
ephemeral_storage_local_ssd_data_cache_countNumber of raw-block local NVMe SSD disks to be attached to the node utilized for GKE Data Cache.0Optional
local_nvme_ssd_countNumber of raw-block local NVMe SSD disks to be attached to the node.Each local SSD is 375 GB in size. If zero, it means no raw-block local NVMe SSD disks to be attached to the node.0Optional
machine_typeThe name of a Google Compute Engine machine typee2-mediumOptional
min_cpu_platformMinimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform." "Optional
enable_confidential_storageEnabling Confidential Storage will create boot disk with confidential mode.falseOptional
max_countMaximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with total limits.100Optional
total_max_countTotal maximum number of nodes in the NodePool. Must be >= min_count. Cannot be used with per zone limits.nullOptional
max_pods_per_nodeThe maximum number of pods per node in this clusternullOptional
strategyThe upgrade stragey to be used for upgrading the nodes. Valid values of state are:SURGE,BLUE_GREEN, or for flex-start and queued provisioningSHORT_LIVED"SURGE"Optional
threads_per_coreOptional The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumednullOptional
enable_nested_virtualizationWhether the node should have nested virtualizationnullOptional
performance_monitoring_unitLevel of Performance Monitoring Unit (PMU) requested. If unset, no access to the PMU is assumed. Values values are:ARCHITECTURAL,STANDARD, andENHANCEDnullOptional
max_surgeThe number of additional nodes that can be added to the node pool during an upgrade. Increasing max_surge raises the number of nodes that can be upgraded simultaneously. Can be set to 0 or greater. Only works withSURGE strategy.1Optional
max_unavailableThe number of nodes that can be simultaneously unavailable during an upgrade. Increasing max_unavailable raises the number of nodes that can be upgraded in parallel. Can be set to 0 or greater. Only works withSURGE strategy.0Optional
node_pool_soak_durationTime needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. By default, it is set to one hour (3600 seconds). The maximum length of the soak time is 7 days (604,800 seconds). Only works withBLUE_GREEN strategy."3600s"Optional
batch_soak_durationSoak time after each batch gets drained, with the default being zero seconds. Only works withBLUE_GREEN strategy."0s"Optional
batch_node_countAbsolute number of nodes to drain in a batch. If it is set to zero, this phase will be skipped. Cannot be used together withbatch_percentage. Only works withBLUE_GREEN strategy.1Optional
batch_percentagePercentage of nodes to drain in a batch. Must be in the range of [0.0, 1.0]. If it is set to zero, this phase will be skipped. Cannot be used together withbatch_node_count. Only works withBLUE_GREEN strategy.nullOptional
min_countMinimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with total limits.1Optional
total_min_countTotal minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true. Cannot be used with per zone limits.nullOptional
nameThe name of the node poolRequired
placement_policyPlacement type to set for nodes in a node pool. Can be set asCOMPACT if desiredOptional
policy_nameIf set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool.Optional
tpu_topologyTPU placement topology for pod slice node pool. For detail seedocumentationOptional
pod_rangeThe name of the secondary range for pod IPs.Optional
enable_private_nodesWhether nodes have internal IP addresses only.Optional
node_affinityThe node affinty in the format"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}".Optional
node_countThe number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clustersRequired
node_locationsThe list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified" "Optional
node_metadataOptions to expose the node metadata to the workload running on the nodeOptional
preemptibleA boolean that represents whether or not the underlying node VMs are preemptiblefalseOptional
spotA boolean that represents whether the underlying node VMs are spotfalseOptional
service_accountThe service account to be used by the Node VMs" "Optional
tagsThe list of instance tags applied to all nodesRequired
valueThe value for the taintRequired
versionThe Kubernetes version for the nodes in this pool. Should only be set if auto_upgrade is false" "Optional
location_policyLocation policy specifies the algorithm used when scaling-up the node pool. Location policy is supported only in 1.24.1+ clusters." "Optional
secondary_boot_diskImage of a secondary boot disk to preload container images and data on new nodes. For detail seedocumentation.gcfs_config must beenabled=true for this feature to work.Optional
queued_provisioningMakes nodes obtainable through the ProvisioningRequest API exclusively.Optional
gpu_sharing_strategyThe type of GPU sharing strategy to enable on the GPU node. Accepted values are: "TIME_SHARING" and "MPS".Optional
max_shared_clients_per_gpuThe maximum number of containers that can share a GPU.Optional
total_egress_bandwidth_tierSpecifies the total network bandwidth tier. Valid values are: "TIER_1" and "TIER_UNSPECIFIED".Optional
consume_reservation_typeThe type of reservation consumption. Accepted values are: "UNSPECIFIED": Default value (should not be specified). "NO_RESERVATION": Do not consume from any reserved capacity, "ANY_RESERVATION": Consume any reservation available, "SPECIFIC_RESERVATION": Must consume from a specific reservation. Must specify key value fields for specifying the reservations.Optional
reservation_affinity_keyThe label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify "compute.googleapis.com/reservation-name" as the key and specify the name of your reservation as its value.Optional
reservation_affinity_valuesThe list of label values of reservation resources. For example: the name of the specific reservation when using a key of "compute.googleapis.com/reservation-name". This should be passed as comma separated string.Optional
local_ssd_encryption_modespecifies the method used for encrypting the local SSDs attached to the node. Valid values are: "STANDARD_ENCRYPTION" and "EPHEMERAL_KEY_ENCRYPTION"Optional
max_run_durationThe runtime of each node in the node pool in seconds, terminated by 's'. Example: "3600s".nullOptional
flex_startEnables Flex Start provisioning model for the node poolnullOptional

windows_node_pools variable

The windows_node_pools variable takes the same parameters asnode_pools but is reserved for provisioning Windows based node pools only. This variable is introduced to satisfy aspecific requirement for the presence of at least one linux based node pool in the cluster before a windows based node pool can be created.

NameDescriptionDefaultRequirement
windows_node_config_os_versionThe Windows OS version to use for the windows node pool. Valid values are OS_VERSION_UNSPECIFIED, OS_VERSION_LTSC2019 and OS_VERSION_LTSC2022.nullOptional

Requirements

Before this module can be used on a project, you must ensure that the following pre-requisites are fulfilled:

  1. Terraform and kubectl areinstalled on the machine where Terraform is executed.
  2. The Service Account you execute the module with has the rightpermissions.
  3. The Compute Engine and Kubernetes Engine APIs areactive on the project you will launch the cluster in.
  4. If you are using a Shared VPC, the APIs must also be activated on the Shared VPC host project and your service account needs the proper permissions there.

Theproject factory can be used to provision projects with the correct APIs active and the necessary Shared VPC connections.

Software Dependencies

Kubectl

Terraform and Plugins

gcloud

Some submodules use theterraform-google-gcloud module. By default, this module assumes you already have gcloud installed in your $PATH.See themodule documentation for more information.

Configure a Service Account

In order to execute this module you must have a Service Account with thefollowing project roles:

  • roles/compute.viewer
  • roles/compute.securityAdmin (only required ifadd_cluster_firewall_rules is set totrue)
  • roles/container.clusterAdmin
  • roles/container.developer
  • roles/iam.serviceAccountAdmin
  • roles/iam.serviceAccountUser
  • roles/resourcemanager.projectIamAdmin (only required ifservice_account is set tocreate)

Additionally, ifservice_account is set tocreate andgrant_registry_access is requested, the service account requires the following role on theregistry_project_ids projects:

  • roles/resourcemanager.projectIamAdmin

Enable APIs

In order to operate with the Service Account you must activate the following APIs on the project where the Service Account was created:

  • Compute Engine API - compute.googleapis.com
  • Kubernetes Engine API - container.googleapis.com

Packages

No packages published

Languages

  • HCL90.2%
  • Go6.9%
  • Shell1.4%
  • Python1.3%
  • Other0.2%

[8]ページ先頭

©2009-2025 Movatter.jp