Deployment on Google kubernetes clusters with Maven

There are two ways to do the deployment

  1. By Installing gcloud sdk and kubectl at your local system.
  2. By using Google cloud shell

Here I am describing the steps for method 2 (By using Google cloud shell) because you don’t need any setup for your local system.

Step 1: Crete a file with name Dockerfile in your git repository root directory with the following content

Step 2: Open and Open Cloud Shell by clicking the button  in the navigation bar in the upper-right corner of the console.

At the bottom below screen will be opened

Step 3: Run the cammand with your cluster name

Step 4: Crete the docker image with git repository

A prompt for git password

Step 5: Push the docker image

Step 6 : create a deployment.yaml file  and place the following code or copy from previous deployment

and apply the deployment

You can check deployment & pods status – scale by following cammands