|
| 1 | +# Google Kubernetes Engine Cluster |
| 2 | + |
| 3 | +Terraform module to create and manage Kubernetes clusters. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +See the [examples](../../examples) directory for working examples for reference: |
| 8 | + |
| 9 | +```hcl |
| 10 | +data "google_compute_network" "my_vpc" { |
| 11 | + name = "my-vpc" |
| 12 | +} |
| 13 | +
|
| 14 | +data "google_compute_subnetwork" "my_vpc_europe_west2" { |
| 15 | + name = "my-vpc" |
| 16 | + region = "europe-west2" |
| 17 | +} |
| 18 | +
|
| 19 | +module "kubernetes_cluster" { |
| 20 | + source = "git::https://github.com/kapetndev/terraform-google-compute.git//modules/gke_cluster?ref=v0.1.0" |
| 21 | + cluster_secondary_range_name = "gke-cluster-pods" |
| 22 | + kubernetes_version = "1.24.12-gke.500" |
| 23 | + location = "europe-west2" |
| 24 | + name = "my-cluster" |
| 25 | + network = data.google_compute_network.my_vpc.id |
| 26 | + services_secondary_range_name = "gke-cluster-services" |
| 27 | + subnetwork = data.google_compute_subnetwork_my_vpc_europe_west2.id |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +## Examples |
| 32 | + |
| 33 | +- [kubernetes-cluster](../../examples/kubernetes-cluster) - Create a Kubernetes |
| 34 | + cluster and separately managed node pool. |
| 35 | + |
| 36 | +## Requirements |
| 37 | + |
| 38 | +| Name | Version | |
| 39 | +|------|---------| |
| 40 | +| [terraform](https://www.terraform.io/) | >= 1.0 | |
| 41 | + |
| 42 | +## Providers |
| 43 | + |
| 44 | +| Name | Version | |
| 45 | +|------|---------| |
| 46 | +| [google](https://registry.terraform.io/providers/hashicorp/google/latest) | >= 4.71.0 | |
| 47 | +| [random](https://registry.terraform.io/providers/hashicorp/random/latest) | >= 3.5.1 | |
| 48 | + |
| 49 | +## Resources |
| 50 | + |
| 51 | +| Name | Type | |
| 52 | +|------|------| |
| 53 | +| [`google_container_cluster.kubernetes_clusters`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster) | resource | |
| 54 | +| [`google_container_engine_versions.supported`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/container_engine_versions) | data source | |
| 55 | +| [`random_id.cluster_name`](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource | |
| 56 | + |
| 57 | +## Inputs |
| 58 | + |
| 59 | +| Name | Description | Type | Default | Required | |
| 60 | +|------|-------------|------|---------|:--------:| |
| 61 | +| `kubernetes_version` | Kubernetes master version | `string` | | yes | |
| 62 | +| `location` | Compute zone or region the cluster master nodes will sit in | `string` | | yes | |
| 63 | +| `name` | Name of the cluster | `string` | | yes | |
| 64 | +| `network` | Name or `self_link` of the Google Compute Engine network to which the cluster is connected | `string` | | yes | |
| 65 | +| `subnetwork` | Name or `self_link` of the Google Compute Engine subnetwork in which the cluster's instances are launched | `string` | | yes | |
| 66 | +| `description` | A brief description of this resource | string | `null` | no | |
| 67 | +| `descriptive_name` | The authoritative name of the cluster. Used instead of `name` variable | `string` | `null` | no | |
| 68 | +| `enable_intranode_visability` | Enable Intra-node visibility for the cluster | `bool` | `false` | no | |
| 69 | +| `enable_vertical_pod_autoscaling` | Enable vertical pod autoscaling | `bool` | `true` | no | |
| 70 | +| `ip_allocation_policy` | Configuration for cluster IP allocations | `object{...}` | `null` | no | |
| 71 | +| `ip_allocation_policy.cluster_ipv4_cidr_block` | The IP address range for the cluster pod IPs. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. Set to a CIDR notation (e.g. 10.96.0.0/14) from the RFC-1918 private networks (e.g. 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) to pick a specific range to use | `string` | `null` | no | |
| 72 | +| `ip_allocation_policy.cluster_secondary_range_name` | The name of the existing secondary range in the cluster's subnetwork to use for pod IP addresses. Alternatively, `cluster_ipv4_cidr_block` can be used to automatically create a GKE-managed one | `string` | `null` | no | |
| 73 | +| `ip_allocation_policy.services_ipv4_cidr_block` | The IP address range of the services IPs in this cluster. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. Set to a CIDR notation (e.g. 10.96.0.0/14) from the RFC-1918 private networks (e.g. 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) to pick a specific range to use | `string` | `null` | no | |
| 74 | +| `ip_allocation_policy.services_secondary_range_name` | The name of the existing secondary range in the cluster's subnetwork to use for service `ClusterIP`s. Alternatively, `services_ipv4_cidr_block` can be used to automatically create a GKE-managed one | `string` | `null` | no | |
| 75 | +| `ip_allocation_policy.stack_type` | The IP Stack Type of the cluster. Default value is `IPV4`. Possible values are `IPV4` and `IPV4_IPV6` | `string` | `IPV4` | no | |
| 76 | +| `issue_client_certificate` | Issue a client certificate to authenticate to the cluster endpoint | `bool` | `false` | no | |
| 77 | +| `kubernetes_version_release_channel` | Kubernetes master version release channel | `string` | `null` | no | |
| 78 | +| `labels` | User defined labels to assign to the cluster | `map(string)` | `{}` | no | |
| 79 | +| `maintenance_policy` | The maintenance policy to use for the cluster | `object{...}` | `null` | no | |
| 80 | +| `maintenance_policy.recurring_window` | The window for recurring maintenance operations | `object{...}` | | yes | |
| 81 | +| `maintenance_policy.recurring_window.end_time` | Time for the (initial) recurring maintenance to end in RFC3339 format. This value is also used to calculte duration of the maintenance window | `string` | | yes | |
| 82 | +| `maintenance_policy.recurring_window.start_time` | Time for the (initial) recurring maintenance to start in RFC3339 format | `string` | | yes | |
| 83 | +| `maintenance_policy.recurring_window.recurrence` | RRULE recurrence rule for the recurring maintenance window specified in RFC5545 format. This value is used to compute the start time of subsequent windows | `string` | `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH` | no | |
| 84 | +| `maintenance_policy.exclusions` | Exceptions to maintenance window. Non-emergency maintenance should not occur in these windows. A cluster can have up to three maintenance exclusions at a time | `list(object{...})` | `null` | no | |
| 85 | +| `maintenance_policy.exclusions[*].end_time` | Time for the maintenance exclusion to end in RFC3339 format | `string` | | yes | |
| 86 | +| `maintenance_policy.exclusions[*].name` | Human-readable description of the maintenance exclusion. This field is for display purposes only | `string` | | yes | |
| 87 | +| `maintenance_policy.exclusions[*].start_time` | Time for the maintenance exclusion to start in RFC3339 format | `string` | | yes | |
| 88 | +| `maintenance_policy.exclusions[*].scope` | The scope of the maintenance exclusion. Possible values are `NO_UPGRADES`, `NO_MINOR_UPGRADES`, and `NO_MINOR_OR_NODE_UPGRADES` | `string` | `null` | no | |
| 89 | +| `prefix` | An optional prefix used to generate the cluster name | `string` | `null` | no | |
| 90 | +| `project_id` | The ID of the project in which the resource belongs. If it is not provided, the provider project is used | `string` | `null` | no | |
| 91 | +| `security_group` | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format `gke-security-groups@yourdomain.com` | `string` | `null` | no | |
| 92 | + |
| 93 | +## Outputs |
| 94 | + |
| 95 | +| Name | Description | |
| 96 | +|------|-------------| |
| 97 | +| `name` | Kubernetes cluster name | |
| 98 | +| `cluster_ca_certificate` | Base64 encoded public certificate that is the root of trust for the cluster | |
0 commit comments