Practice K8S on Google Cloud

Tram Ho

Kubernetes (K8S) is so popular right now, everyone talks about it. However, to use it is not easy. In today’s post I will not go too much into the definitions, but go straight into reality for everyone to imagine. In the next articles, I will detail each of the steps in detail.

I will use Google Cloud’s K8S, so everyone needs to have a google cloud account with ($ 300 free). Follow this guide https://cloud.google.com/free/docs/gcp-free-tier/#free-trial

Step 1 create a cluster https://console.cloud.google.com/kubernetes/list on this link, click create to create a cluster, select Standard type

Named cluster, other parameters to default, will learn in detail later.

Wait about 5 minutes, google cloud will create cluster for you.

So I have created 1 K8S cluster. (Google has done it all, my job is to use it to deploy the system on it).

The next step is to deploy an application onto it. In this example I will use 1 image available on the google cloud nginx repository : latest (in fact, I will have to build the docker image and push it up). returns to the clusters tab. choose deploy

Click continue and select deploy is finished.

After deploying is complete, the system will create 3 Pods for me by default

On each Pod there will be a running container, see details of the deployment we will see

Want to access from the outside, I will have to create 1 more service, it acts as a revert proxy.

Click on Expose to expose it to the outside so you can access it.

There are 2 textboxes to fill, because my nginx runs port 80 (Target Port). We want the client to access port 8080 (Port). See photo above for details.

After creating the service, click on Service & Ingress with the results below.

The endpoint contains the public IP and port information, at which point you have successfully accessed your web site.

This article is very simple, the simplest steps to practice. In the next article, I will handle it to help you customize K8S.

  • Differentiate more about Standard and Autopilot
  • AutoScaling, configuring parameters, when the system automatically scales
  • Build and use your own image, push it to Google cloud repository
  • Instead of using the UI, users can use the cloud shell or Commandline on the local machine.
  • Use YAML to configure deploy, services. …
Share the news now

Source : Viblo