EMAIL SUPPORT

dclessons@dclessons.com

LOCATION

US

Introduction to Kubernetes Engine

Introduction to Kubernetes Engine

Google Kubernetes Engine

Google provides Container-as-a-service (CaaS) offering. GKE allows us to create and manage kubernetes clusters on demand.  We are going to cover below concepts in detail:

  • Application Microservices
  • Containers
  • Kubernetes
  • Google Kubernetes Engine

Introduction to Microservices

In the Legacy environment, Application were designed using Monolithic Architecture, means Multiple services were hosted together on single node. But in Microservices Architecture   Applications are divided in to several micro-services and are hosted on a separate node.

Below figure describes difference between Monolithic and Microservices

In New Architecture, Each Microservices are responsible for a single functions and are loosely coupled and can be managed separately. Each Microservices communicates with each other using API. Whenever you need to upgrade the Application, you can upgrade a single service without affecting other components. In this Architecture, you can also scale the services that requires scaling without touching others.

Containers

Let’s understand containers by comparing it with Virtual Machine. Virtual Machines virtualize hardware, whereas Containers virtualize the Operating systems. Multiple containers can be hosted on one operating system running isolated processes.

Below figure describes difference between Application on host and Applications in Containers.

Below are some advantages using containers:

  • Application can use their libraries without conflicting with other application libraries.
  • Application can be limited to resource usage.
  • Applications are always self-contained with all of their dependencies and are not tied to an OS or cloud provider.

Container runtime is the software, that allows container to run. There are also many container runtimes available, but google recommends using Containerd. For many years’ standard was to use Docker runtime, but now it has been changed to Containerd. Containerd identified as most secure and efficient standard for kubernetes and also for GKE.

Kubernetes

Kubernetes also called as K8, is Open source container orchestrator developed by Google and donated to Cloud Native Computing foundation. It allows us to deploy, scale, and manage containerized application and it can also run on multiple environments both on-premises as well as in public cloud.

Kubernetes Architecture

Kubernetes Architecture consist of Kubernetes cluster, which consists of multiple nodes. Master node are responsible for managing the cluster, while worker nodes host the workloads. These Worker nodes are also called as Pods, which are most atomic unit of Kubernetes. These Pods contains one or more containers.

Below diagram explains the Kubernetes cluster

Master Nodes:

It is the Control plane, which maintains the desired states of the cluster. It Monitors objects definitions (YAML files) and makes sure that they are scheduled on the worker node. Below diagram explains how Master node as Control plane works

The Master Node runs Multiple Processes:

  • API Server: It Exposes Kubernetes API, and is front end of the control plane
  • Controller Manager: Multiple controllers are responsible for overall health of the cluster.
  • Etcd: A database that hosts the cluster state information.
  • Scheduler: It is responsible for placing the pods across the nodes to balance resource consumption.

For HA and Redundancy, multiple Master Nodes should be run, without master node, the control plane is essentially down. All the cluster management operation you perform go through the master.

Worker Node

A Worker Node can be virtual Machine or even a physical server. Worker Nodes are responsible for running containerized applications. Worker nodes are managed by master node. They run following services:

  • Kubelet: This reads the Pod Specification and make sure that right containers run in pods. It Interacts directly with the master node.
  • Kube-Proxy: It is the Network Proxy runs on each node. It enables usage of service.
  • Container Runtime: It is used to run containers.

Kubernetes Objects

They are records of intent and are defined in YAML format. Once created, Kubernetes take care of keeping them in state that has been declared in the definition file. Some Important Objects are as follows:

  • Pods
  • Replica Sets
  • Replication Controller
  • Deployments
  • Namespaces

Lets understand the deployment definition:

Deployment: This definition will deploy two pods with containers using nginx image.

In this we have to have following data available:

  • api Version: Version of Kubernetes API we want to use.
  • Kind: The Kind Object to be created
  • Metadata: data that helps uniquely identify the objects such as name
  • Spec: Specification of the object, which depends on it type.

In Order to create or update an existing object, we can use following commands

Kubectl apply –f definition.yaml

Here, definition. yaml file contain an object definition. In order to run our first deployment, we must save definition in the definition. yaml file and run using kubectl command.


Comment

    You are will be the first.

LEAVE A COMMENT

Please login here to comment.