Home - vidyasekaran/GCP GitHub Wiki

Create a python app dockerize it and deploy in GCP's GKE (Google kubernetes engine)

Youtube channel - IT k Funde

https://www.youtube.com/watch?v=GKuk-TBmNcI&list=PLcnJIHtHiTA2Jp3klIkeHiwqGrxjXBzh6&index=5

We containerized our app and deployed in Google run followed by deploying same in GKE (fully managed kubernetes services to orchastrate containerized apps.

  1. First we create python program -> created docker file -> used container build to create container image -> pushed container image to container registry -> deployed in google cloud run. (single standalone container image)

  2. Instead of deploying in google cloud run we now deploy in GKE so that we can scale container instances and also expose app to external world

  3. Deployment.yml - manages resources frontend web app deployed in container

  4. services.yml - defines single point of entry to access application pods via load balancer.

  5. To build a container image (docker build and docker push) using DockerFile and app.py, we run below command where we have python file and Docker image. The below command creates a container image named hello-youtube-gke and push it to docker registry, you can check it in gcp under container registry..

gcloud build submit --tag gcr.io/your project id/hello-youtube-gke .

  1. Create Cluster -- gcloud container clusters create hello-youtube-gke-cluster --num-nodes 1 --enable-basic-auth --issue-client-certificate --zone us-central1-a you can cross check whether cluster is created in GCP.

  2. kubectl apply -f deployment.yaml ; kubectl get pods

  3. kubectl apply -f services.yaml ; kubectl get services (where u see external ip to acess service)

Delete a GCP Project

  1. In the Google Cloud Console (GCP), the “hamburger-icon” on the top left corner of the screen, select the IAM & Admin under Products. (You must be logged in)

2)Click on Settings, if you had created a single project then it will be only be shown, click on Shut Down to delete the project.