Back to blog
Jul 05, 2024
3 min read

Deploy a Hello World App on GKE

When we learn any new programming skill, print Hello World is a must.

Hey there, today, we’re diving into the world of containerization and cloud deployment with a simple yet powerful tutorial on how to deploy a Hello World app on Google Kubernetes Engine (GKE). This is a simple guide for beginners. Let’s start…

At first, Enable the Kubernetes Engine API, img00

then go to GKE cluster interface. Click Create button. img01

Under Cluster basics, do the following:

In the Name field, enter the following name: hello-world-cluster

Please remember the Region that you selected, at the end of the step, you need to use it. img02

Keep the default values for the rest of the settings and click Create button to start creating the cluster.

img03 img04

In the Google Cloud console, go to the GKE Workloads page. Click Create deployment

img05

Leave Existing container image selected, and in Image path enter the following path:

us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0

then click Continue button

img06

In Deployment name, enter the following name: hello-world-app

In Kubernetes Cluster, select hello-world-cluster. Click Continue.

img07

In the Expose section, create a load balancing Kubernetes Service to direct external requests to your app:

  • Select Expose deployment as a new service.
  • Leave Port 1 set to 80.
  • In Target port 1, enter 8080.
  • Click Deploy.

GKE automatically assigns an available external IP address to the Service. This Service is considered to be part of the hello-world-app workload.

img08

Wait until the deployment completes and you see the Deployment details page. To view a live demo of the hello-world-app workload, click Next.

img09

img10

img11

In the Endpoints column, click the IP address, which is publicly available. GKE opens a new browser tab and sends a request to your app. Dismiss any secure-site warnings, and you should see Hello, world! in the new browser tab.

img12

Congratulations! 👍

Toutes nos félicitations! 👍

Don’t forget to clean up your resources when you’re done to avoid unnecessary charges.

You can operate the Google Cloud Console interface, to delete the cluster by clicking the checkbox and clicking the delete button.

or you can delete the cluster by commandline. According to your config, you should set the zone value, then run the commandline.

gcloud container clusters delete hello-world-cluster --zone=us-central1-a