This project demonstrates deploying a Flask application with a MongoDB backend to Google Kubernetes Engine (GKE) using Docker, Helm, and GitHub Actions for CI/CD.
- Google Cloud Platform (GCP) account
- Docker Hub account
- GitHub account
- Google Cloud SDK
- kubectl
- Helm
-
Create a GCP Project
- Go to the GCP Console.
- Create a new project.
-
Enable the Kubernetes Engine API
- In the GCP Console, navigate to
APIs & Services > Library. - Enable the
Kubernetes Engine API.
- In the GCP Console, navigate to
-
Create a GKE Cluster
- In the GCP Console, navigate to
Kubernetes Engine > Clusters. - Create a new cluster.
- In the GCP Console, navigate to
-
Authenticate and Configure gcloud
- Authenticate with your GCP account:
gcloud auth login
- Set the default project:
gcloud config set project YOUR_PROJECT_ID - Get credentials for your cluster:
gcloud container clusters get-credentials YOUR_CLUSTER_NAME --zone YOUR_CLUSTER_ZONE
- Authenticate with your GCP account:
Clone the repository to your local machine:
git clone https://github.com/your-username/flask-app.git
cd flask-app
Build and Run Docker Container
docker build -t your-dockerhub-username/flask-app:latest .
docker run -p 5001:5001 your-dockerhub-username/flask-app:latestAccess the Flask App
- Open your browser and go to http://localhost:5001.
Push Changes to GitHub
git add .
git commit -m "Deploy to GKE"
git push origin main