Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
JaydenAung
Employee Alumnus
Employee Alumnus

Deploy a GKE cluster in 5 minutes

Deploy a GKE cluster in 5 minutes

Here is a couple of scripts that automate deploying Kubernetes cluster (GKE) on Google Cloud Platform. You could use automation tools like Terraform to do this but this is just another way of automating the same thing. Whether you're doing a quick test or demo/POC, you can use this very simple shell script to deploy a GKE cluster in 5 minutes, and clean it up in about 3 minutes. Basically, one script to create a cluster with a demo app, and another script to clean up.

You will need to have an account on Google Cloud Platform and should have created a project.

gke_setup.sh

Before executing the script, please update the following values in the script:

#UPDATE THIS with your GCP Project Name
PROJECT_ID="YOUR_PROJECT_NAME"

#UPDATE THIS with the location of Docker Image of your choice
IMAGE="gcr.io/$PROJECT_ID/your-docker-image:v1"

And basically execute the script, and provide the following when the script prompts:

  • Your Cluster name (Default is my-cluster)
  • App Name (Default is demo-app)
  • GCP Region (Default is asia-southeast1)
  • Your Kubernetes service name (Default is my-service)
./gke_setup.sh

 

Now you have a working cluster! Note down the Load Balancer's IP and access it on the browser. At this point, you should see the demo app.

Sample demo appSample demo app

cleanup_cluster.sh

This is the script that deletes and cleans up GKE clusters. The script will basically delete deployments, and services before deleting the cluster itself.

Execute the script:

echo "Y" | ./cleanup_cluster.sh

Note: Add echo "Y" | before the script to auto-answer Yes to a prompt.

 

Where to download the scripts?

See my original Github repo here https://github.com/jaydenaung/gkelab to use the scripts!

How about a security posture assessment?

Once you've deployed your cluster, I'd strongly recommend that you check out my article on how to run a security posture assessment on your Kubernetes cluster using CloudGuard CSPM.

 

Best,

Jayden Aung

0 Kudos
0 Replies

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events