Terraform config that creates a basic kubernetes cluster that host a nginx server. This project is meant to be used as a boilerplate only.
HTTP(S) -> Public IP -> Ingress -> Service -> Deployment
- Install terraform
- Autoscaling of node
- Autoscaling of pods
- SSL certificate for domain
You can use existing SSL Certificate or create using Letsencrypt ssl certificate generator. Copy it in ./certificate folder
- ./certificate/fullchain.pem
- ./certificate/privkey.pem
Visit Google Console to create an IAM profile. While creating the profile, it lets you download gcloud-service.json
file. Place it in root folder.
Create terraform.tfvars
on root folder. For example.
gcp_project = "gcp-project-1234"
dev_cluster_master_auth_username = "cluster_username"
dev_cluster_master_auth_password = "cluster_password"
Change host
in network.tf
.
Run these commands
terraform init
terraform plan
terraform apply
Update DNS config of the domain by added a new A
record with the ip
printed while running terraform apply
on step 5
.