https://github.com/ialejandro/terraform-gke
Deploy GKE with Terraform
https://github.com/ialejandro/terraform-gke
gke google kubernetes terraform
Last synced: 20 days ago
JSON representation
Deploy GKE with Terraform
- Host: GitHub
- URL: https://github.com/ialejandro/terraform-gke
- Owner: ialejandro
- License: mit
- Archived: true
- Created: 2021-06-22T19:54:13.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-07T08:36:55.000Z (over 1 year ago)
- Last Synced: 2025-03-10T01:26:59.936Z (3 months ago)
- Topics: gke, google, kubernetes, terraform
- Language: HCL
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform GKE deploy
## Documentation
* [Kubernetes provider](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs)
* [Google provider](https://registry.terraform.io/providers/hashicorp/google/latest/docs)
* [GKE module](https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/latest)
* [GKE Release versions](https://cloud.google.com/kubernetes-engine/docs/release-notes)## Requirements
* Terraform: `>= 0.13, < 0.14`
* Generate `service-account` in GCP
* The VPC must be exists
* The subnets must be exists and ip ranges (pods and services)## First steps!
1. Create bucket GCS to save `.tfstate`
2. Modify `config.tf` with properly `bucket`
3. Download `service-account` and `export GOOGLE_APPLICATION_CREDENTIALS=`
4. Modify `gke.auto.tfvars` with your values
5. Install all dependencies and providers: `terraform init`
6. Deploy: `terraform apply`## Files
* `config.tf`: providers, requirements and backend for Terraform
* `gke.auto.tfvars`: values for deployment
* `main.tf`: main file with GKE resource
* `outputs.tf`: output resources
* `variables.tf`: declare all variables with default values## Default values
```bash
# GKE
## GENERAL
project_id = "CHANGE-ME"
gke_cluster_name = "cluster-gke"
gke_version = "latest"## WORKERS
gke_node_pool_name = "default"
gke_node_pool_machine_type = "e2-medium"
gke_node_pool_min_count = 1
gke_node_pool_max_count = 1
gke_node_pool_volume_size = 100# NETWORK
vpc = "my-vpc"
subnet = "my-subnet"
ip_range_pods = "pods"
ip_range_services = "services"
```## Tests
* (Average) Complete deployment: ~10 minutes