bc8f0c90b7
* fix autoscaling block * invert autoscaling block condition * add autoscaling test |
||
---|---|---|
.. | ||
README.md | ||
main.tf | ||
outputs.tf | ||
variables.tf | ||
versions.tf |
README.md
GKE nodepool module
This module allows simplified creation and management of individual GKE nodepools, setting sensible defaults (eg a service account is created for nodes if none is set) and allowing for less verbose usage in most use cases.
Example usage
Module defaults
If no specific node configuration is set via variables, the module uses the provider's defaults only setting OAuth scopes to a minimal working set and the node machine type to n1-standard-1
. The service account set by the provider in this case is the GCE default service account.
module "cluster-1-nodepool-1" {
source = "./fabric/modules/gke-nodepool"
project_id = "myproject"
cluster_name = "cluster-1"
location = "europe-west1-b"
name = "nodepool-1"
}
# tftest modules=1 resources=1
Internally managed service account
To have the module auto-create a service account for the nodes, define the service_account
variable without setting its email
attribute. You can then specify service account scopes, or use the default. The service account resource and email (in both plain and IAM formats) are then available in outputs to assign IAM roles from your own code.
module "cluster-1-nodepool-1" {
source = "./fabric/modules/gke-nodepool"
project_id = "myproject"
cluster_name = "cluster-1"
location = "europe-west1-b"
name = "nodepool-1"
service_account = {}
}
# tftest modules=1 resources=2
Variables
name | description | type | required | default |
---|---|---|---|---|
cluster_name | Cluster name. | string |
✓ | |
location | Cluster location. | string |
✓ | |
project_id | Cluster project id. | string |
✓ | |
gke_version | Kubernetes nodes version. Ignored if auto_upgrade is set in management_config. | string |
null |
|
labels | Kubernetes labels applied to each node. | map(string) |
{} |
|
max_pods_per_node | Maximum number of pods per node. | number |
null |
|
name | Optional nodepool name. | string |
null |
|
node_config | Node-level configuration. | object({…}) |
{…} |
|
node_count | Number of nodes per instance group. Initial value can only be changed by recreation, current is ignored when autoscaling is used. | object({…}) |
{…} |
|
node_locations | Node locations. | list(string) |
null |
|
nodepool_config | Nodepool-level configuration. | object({…}) |
null |
|
pod_range | Pod secondary range configuration. | object({…}) |
null |
|
reservation_affinity | Configuration of the desired reservation which instances could take capacity from. | object({…}) |
null |
|
service_account | Nodepool service account. If this variable is set to null, the default GCE service account will be used. If set and email is null, a service account will be created. If scopes are null a default will be used. | object({…}) |
null |
|
sole_tenant_nodegroup | Sole tenant node group. | string |
null |
|
tags | Network tags applied to nodes. | list(string) |
null |
|
taints | Kubernetes taints applied to all nodes. | list(object({…})) |
null |
Outputs
name | description | sensitive |
---|---|---|
name | Nodepool name. | |
service_account_email | Service account email. | |
service_account_iam_email | Service account email. |