Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
What is Kubernetes?
3.
Advantages of Kubernetes
4.
Applications of Kubernetes
5.
Kubernetes Engine: Qwik Start
5.1.
Starting Your lab
5.2.
Activate Cloud Shell
5.3.
Task 1. Set a default compute zone
5.4.
Task 2. Create a GKE cluster
5.5.
Task 3. Get authentication credentials for the cluster
5.6.
Task 4. Deploy an application to the cluster
5.7.
Task 5. Deleting the cluster
6.
Frequently Asked Questions
6.1.
What is Kubernetes Engine?
6.2.
What is a cluster?
6.3.
What is the difference between Kubernetes and Docker?
7.
Conclusion
Last Updated: Mar 27, 2024

Google Kubernetes Engine

Author Nagendra
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

The open source Kubernetes cluster management technology powers Google Kubernetes Engine (GKE) clusters. The interfaces you use to communicate with your container cluster are provided by Kubernetes. To deploy and manage your apps, carry out administrative duties, establish policies, and keep track of the wellbeing of your deployed workloads, you use Kubernetes commands and resources. Kubernetes is based on the same architectural concepts that power popular Google services, and it offers many of the same advantages: automatic scaling, rolling updates, monitoring and liveness probes for application containers, and more. You are utilising technologies based on Google's more than ten years of expertise running production workloads in containers when you run your applications on a container cluster.

This blog discusses Google Kubernetes Engine, including its features, applications, and step-by-step instructions for Kubernetes Engine Lab.

Without further ado, let's get started.

What is Kubernetes?

Kubernetes is an open source solution to deploy, scale, and manage containerized applications everywhere. It is also sometimes abbreviated as K8s, with the 8 denoting the number of letters between the "K" and the "s."
Kubernetes streamlines application management by automating operational activities associated with container management and providing built-in commands for application deployment, the rollout of updates, scaling up and down to accommodate changing requirements, monitoring, and more.

Let's look at the advantages of using Kubernetes.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Advantages of Kubernetes

The following are the advantages of using Kubernetes:

  • Automated operations 
    You can automate daily tasks using Kubernetes since it comes with built-in commands that take care of a lot of the labor-intensive aspects of application management. Applications can be made to always operate in the manner that you planned.
     
  • Abstraction of infrastructure 
    Kubernetes manages the computation, networking, and storage on behalf of your workloads after installation. Developers may now concentrate on applications rather than the underlying environment, thanks to this.
     
  • Service health monitoring 
    When a container fails or stalls, Kubernetes restarts it and only makes the service available to users after confirming that it is running. Kubernetes continuously monitors the health of your services.
     

Let's look at the applications of Kubernetes.

Applications of Kubernetes

Applications built with Kubernetes are simple to deploy and maintain everywhere. When offered as a managed service, Kubernetes provides you with a selection of options to suit your needs. Here are some frequent use scenarios:

  • Increasing development velocity 
    You can create cloud-native, microservices-based apps with the aid of Kubernetes. Additionally, it enables current programs to be containerized, making it the cornerstone of application modernization and enabling quicker app development.
     
  • Deploying applications anywhere 
    Kubernetes is designed to be utilised anywhere. You may operate your apps on-premises, in public clouds, and in hybrid deployments between those two. In order for you to run your applications where you require them.
     
  • Running efficient services 
    The size of a cluster necessary to run a service can be adjusted automatically by Kubernetes. This gives you the ability to run your apps effectively and automatically scale them up or down based on demand.
     

It's time to dive into the step-by-step procedure of completing the Kubernetes Engine Lab.

Kubernetes Engine: Qwik Start

Google Kubernetes Engine (GKE) offers a managed environment for deploying, maintaining, and scaling your containerized applications. A container cluster is created by combining several machines (particularly Compute Engine instances) in the Kubernetes Engine environment.

Follow the following procedures:

Starting Your lab

  • Select "Start Lab" from the menu. In the Lab Details panel, which is on the left, are the following:
    • The button to access Google Console
       
    • Time Remaining
       
    • The temporary login information required for this lab
       
    • Should it be necessary, further details to complete this lab
       
  • Open Google Console. The lab starts spinning up resources before opening a new tab on the Sign in page.
     
  • In the Sign in dialogue, copy the Username from the Lab Details panel if necessary. Choose Next.
     
  • From the Lab Details panel, copy the password, and then paste it into the Welcome dialogue. Select Next
     
  • Go through the following pages by clicking:
    • The terms and conditions are accepted.
       
    • Do not include two-factor authentication or recovery alternatives (because this is a temporary account).
       
    • Avoid registering for free trials.
       
  • A few while later, the Cloud Console launches.
     

Activate Cloud Shell

A virtual machine called Cloud Shell is full of programming tools. It uses the Google Cloud and provides a persistent 5GB home directory. Your Google Cloud resources can be accessed via the command line using Cloud Shell.

  • Click the Activate Cloud Shell button in the top right toolbar of the Cloud Console.
     
  • Then click Continue.
     

Provisioning and connecting to the environment take some time. You have already authenticated when you connect, and your PROJECT_ID is configured for the project.

Task 1. Set a default compute zone

Your clusters and their resources reside in your compute zone, which is roughly regional in scope. For instance, the us-central1 area includes the zone us-central1-a.

Start a new session in Cloud Shell and use the following command to change your default compute zone to us-central1-a:

Command:

gcloud config set compute/zone us-central1-a

Output:

Updated property [compute/zone].

Task 2. Create a GKE cluster

A cluster is made up of several nodes, worker machines, and at least one cluster master machine. Nodes are virtual machine (VM) instances running on Compute Engine that execute the Kubernetes operations required to integrate them into the cluster.

Run the following command to establish a cluster, substituting [CLUSTER-NAME] for the cluster name you like (for example:my-cluster).

Command:

gcloud container clusters create [CLUSTER-NAME]

Output:

NAME: my-cluster
LOCATION: us-central1-a
MASTER_VERSION: 1.22.8-gke.202
MASTER_IP: 34.67.240.12
MACHINE_TYPE: e2-medium
NODE_VERSION: 1.22.8-gke.202
NUM_NODES: 3
STATUS: RUNNING

Task 3. Get authentication credentials for the cluster

You require authentication credentials to communicate with your cluster after it has been created.

Run the following command to authenticate the cluster, substituting [CLUSTER-NAME] with the name of your cluster:

Command:

gcloud container clusters get-credentials [CLUSTER-NAME]

Output:

Fetching cluster endpoint and auth data.
kubeconfig entry generated for my-cluster.

Task 4. Deploy an application to the cluster

A containerized application can now be released to the cluster. You will run hello-app in your cluster for this lab.
The resources in your cluster are created and managed by GKE using Kubernetes objects. For the purpose of deploying stateless applications like web servers, Kubernetes offers the Deployment object. Rules and load balancing are defined by service objects for internet access to your application.

Run the following kubectl create command to build a new Deployment hello-server from the hello-app container image:

Command:

kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0

Output:

deployment.apps/hello-server created

The hello-server deployment object is created by this Kubernetes operation. The —image flag in this situation designates a container image to deploy. gcr.io/google-samples/hello-app: The command retrieves the sample image from a Container Registry bucket. The number 1.0 denotes the precise image version to retrieve. The recent version is used if no version is supplied.

Task 5. Deleting the cluster

A cluster can be deleted by the following steps:

  • Execute the following command to remove the cluster:

Command:

gcloud container clusters delete [CLUSTER-NAME]
  • Enter "Y" when asked to confirm.
     

It could take a few minutes to delete the cluster.

Also see, kubernetes interview questions

Frequently Asked Questions

What is Kubernetes Engine?

Google Kubernetes Engine (GKE) offers a managed environment for deploying, maintaining, and scaling your containerized applications. The GKE environment is made of a cluster of many machines, notably, Compute Engine instances.

What is a cluster?

A group of machines that run containerized apps is known as a Kubernetes cluster. Applications are packaged with their dependencies and some essential services when they are containerized. They are less heavy and more adaptable than virtual machines.

What is the difference between Kubernetes and Docker?

The two vary in that Kubernetes is designed to run containerized apps across a cluster, whereas Docker focuses on packing containerized programs on a single node.

Conclusion

In this article, we have extensively discussed the details of Google Kubernetes Engine along with its advantages, applications, and detailed steps of Kubernetes Engine Lab.

We hope that this blog has helped you enhance your knowledge regarding Google Kubernetes Engine, and if you would like to learn more, check out our articles on Google Cloud Certification. You can refer to our guided paths on the Coding Ninjas Studio platform to learn more about DSADBMSCompetitive ProgrammingPythonJavaJavaScript, etc. To practice and improve yourself in the interview, you can also check out Top 100 SQL problemsInterview experienceCoding interview questions, and the Ultimate guide path for interviews. Do upvote our blog to help other ninjas grow. Happy Coding!!

Next article
Overview of Artifact Registry
Live masterclass