This is automated deployment of flask application on Google Kubernetes Engine. GKE cluster is created with Terraform along with Cloud Build Trigger. Cloud Build is used for CICD deployments.
- GCP Project with billing enabled
- GCP Cloud Source Repository for version control
- Enable below APIs of from GCP console.
- container.googleapis.com
- cloudresourcemanager.googleapis.com
- compute.googleapis.com
- storage-component.googleapis.com
- iam.googleapis.com
- iamcredentials.googleapis.com
- cloudbuild.googleapis.com
- Terraform installed on the local machine
- Cloud Build Setup
- Service account with permissions to deploy GKE cluster, Create service account, add permissions to service account and create cloud build trigger.
- Cloud Build
- GKE
- IAM - service account for GKE
- VPC - This include VPC, Subnet and Firewall
Note : Terraform is configured with local backend. We can configure cloud storage as remote backend when working with team.
- Clone the repository with git clone https://github.com/oneaniket/flask-gke.git
- cd to flask-gke/terraform
- Enter your prefered GCP region, GCP Project ID in which to deploy the infra and Cluster name of the GKE cluster.
- Run terraform init
- Run terraform plan
- Run terrafom apply --auto-approve
Name | Description | Default | Required |
---|---|---|---|
Region | Region for GKE Cluster | us-central1 | Yes |
Project | ID of the project where infra will be deployed | project_id | Yes |
Cluster Name | Name of the GKE cluster | flask-app | Yes |