How to use Kubernetes on GCP

Kubernetes, aka, K8s is an open-source system for automating deployment, scaling, and managing containerized applications. It handles the work of scheduling containers onto a compute cluster and manages the workloads to ensure they run as the user intends.

What will you learn:-

  • What is Kubernetes
  • How to use Kubernetes on GCP

What is Kubernetes

Kubernetes, aka, K8s is an open-source system for automating deployment, scaling, and managing containerized applications. It handles the work of scheduling containers onto a compute cluster and manages the workloads to ensure they run as the user intends.

Kubernetes Architecture

It has two major components:-

  • Master Node – The master node receives input from the CLI or UI as it is the entry point for all the administrative tasks. It has the following four components:-
    • 1. API Server – The API server is the entry point for all the REST commands used to control the cluster.
    • 2. Controller Manager – Is a daemon that regulates the Kubernetes cluster, and manages different non-terminating control loops.
    • 3. etcd – etcd is a simple, distributed, consistent key-value store. It’s mainly used for shared configuration and service discovery.
    • 4. Scheduler – The scheduler schedules the tasks to slave nodes. It stores the resource usage information for each slave node.
  • Worker Node – Worker nodes contain all the necessary services to manage the networking between the containers, communicate with the master node, and assign resources to the scheduled containers.It’s three major components are:-
    • Kubelet – It watches for tasks sent from the API Server, executes the task, and reports back to the Master. It also monitors pods and reports back to the control panel if a pod is not fully functional.Kube-proxy – The Kube-proxy makes sure that each node gets its IP address, implements local iptables and rules to handle routing and traffic load-balancing.Container Runtime – The container runtime is the software that is responsible for running containers. Containers are run inside the pods

Kubernetes supports several container runtimes: DockercontainerdCRI-O, and any implementation of the Kubernetes CRI (Container Runtime Interface).

Using Kubernetes on GCP

GCP provides a managed and secured Kubernetes service called GKE (Google Kubernetes Engine) to create and maintain k8s clusters. GKE is GCP’s enterprise-grade platform to deploy containerized applications and services on kubernetes clusters.

Key Features of GKE:

  1. Enterprise-ready Kubernetes applications are directly available for deployment from Google Marketplace.
  2. Cluster auto-scaling as well as Horizontal and Vertical Pod auto-scaling based on changing workload requirements.
  3. Workload and network security provided by GKE sandbox as a second layer of defense between containerized workloads in addition to supporting the native Kubernetes Network Policy

Check out all the features provided by GKE here.

Cluster Creation on GKE:

Follow the steps below to create a cluster using GKE console:

In the Cluster basics section, complete the following:

  • Enter the Name for your cluster. ( e.g. my-first-cluster )
  • For the Location type, select Zonal, and then select the desired zone for your cluster. ( e.g. us-central1-c)
  • Choose a Master Version. Let’s go with the default selection for “Static version” for now. (which is 1.14.10-gke.24 as of writing this article)

From the navigation pane, under Node Pools, click default-pool.

  • Enter a Name for the default Node pool. (e.g. my-default-pool)
  • Choose the Node version for your nodes. (Let’s leave it to the default value which is 1.14.10-gke.24 as of this writing)
  • Enter the Number of nodes to create in the cluster. (Let’s have 4 nodes)
  • Leave other options as default.

From the navigation pane, under Node Pools, click default-pool.

  • Enter a Name for the default Node pool. (e.g. my-default-pool)
  • Choose the Node version for your nodes. (Let’s leave it to the default value which is 1.14.10-gke.24 as of this writing)
  • Enter the Number of nodes to create in the cluster. (Let’s have 4 nodes)
  • Leave other options as default.
  • From the navigation pane, under Node Pools, click Nodes.
  • From the Image type drop-down list, select the desired node image. Let’s leave it to default which is Container-Optimized OS or “cos” as of this writing. You can read more about Node images on GKE here.
  • Choose the default Machine configuration to use for the instances. Read here for comparison of different machine types and the recommended types for different use cases.
  • The default machine type is n1-standard-1. Each machine type is billed differently. For machine type pricing information, refer to the machine type price sheet.
  • From the Boot disk type drop-down list, select the desired disk type.
  • Enter the Boot disk size.
  • Leave other fields as default and Click Create.
  • After a few minutes, you will have your first k8s cluster running with your chosen configuration.
Tags

What do you think?

Related articles

Contact us

There’s more to Tech than you have experienced!

Get in touch with us to know the possibilities. We’re happy to describe and design custom Tech solutions after understanding your business goals and needs.

Call us at :

Your benefits:
What happens next?
1

Schedule a Call at Your Convenience

2

Discovery and Consulting Meeting

3

Project Plan & proposal preparation

Schedule a Free Consultation