Blog

Kubernetes Tutorial

  • (4.0)
  • | 1331 Ratings |
  • Last Updated February 27, 2018

This tutorial gives you an overview and talks about the fundamentals of Kubernetes.

Kubernetes is ‘an open-source composition engine that is specifically designed for automating deployment, scaling and management of containerized applications.’ It is flexible for containers of any size and scale and is supported by a tool to group continues into logical units and to track, manage and monitor all of them. Cabinets helps you do that and is considered the absolute tool for container management.

Enthusiastic about exploring the skill set of Kubernetes? Then, have a look at the Kubernetes Training together additional knowledge. 

What is Kubernetes:

Kubernetes is basically a system designed specifically to manage containerized applications of distinct kinds across a cluster of nodes. It  was designed to address the disconnect between the way on which the modern, clustered infrastructure is designed. Almost all cluster technologies strive hard to provide a platform that's distinctive or application deployment. 

The user should not have to care about where scheduling of the work. The unit of the work presented to the user is at the service level and might be accomplished by any of the member nodes. On the flipside, many applications build with scaling in mind are literally created up services of smaller element, that should be regular on constant host. it's even a lot of necessary once they trust specific networking conditions so as to communicate appropriately.

Consider Applications rather Servers

Kubernetes, with its elegant abstractions permits developers to accept applications rather servers of individual containers on specific Servers, pet servers, hostnames etc. Pods, replication services and controllers are the basic units of Kubernetes and are used to describe system’s desired state. In Kubernetes, the deployment is handled based on the rules and moves towards a forward step further by proactively monitoring, scaling and auto-healing of these services to maintain their desired state. 

Kubernetes Features:

Kubernetes helps users to quickly and efficiently respond to the demands of their customer with the following features as follows:

* Helps to deploy any applications quickly and predictably.
* Roll out new features seamlessly and Scale your applications on the fly
* Limit the usage of hardware to required resources only.
* Helps to relieve the burden of running applications in public and private clouds.

This tutorial provides a walkthrough about the basics of the Kubernetes cluster composition system. Each module consists of some background information on major features of kubernetes and concepts including an interactive online tutorial. This tutorial let the reader to manage a simple cluster and its containerized applications.

Basic Components of Kubernetes

Using these interactive tutorials, you can learn how to:

* Deploy an application that is containerized on a cluster
* Debug the containerized application and to Scale
* Update the containerized application using a new software version.

Kubernetes Architecture

H3 Master Components

The systems like CoreOS, which are at infrastructure level strives hard to create an environment that is uniform where each host is interchangeable and disposable. On the other side, Kubernetes operates with a particular level of host specialization.

Kubernetes cluster controlling services are known as the master or control plane components. These operates according to the primary management contact point for administrators and also provides several cluster wide systems for the relatively dumb worker nodes, which can be installed on a single machine or distributed across multiple ones.

Kubernetes Architecture

The cluster architecture follows client-server architecture with a master installed on one machine and the nodes on separate Linux machines.

Master Components of Kubernetes Master Machine: The key components of Kubernetes are as follows:
etcd
It stores the information related to configuration that can be used by the cluster nodes. It is with high availability key value store distributed among multiple nodes and with a distributed key value store can accessible only by Kubernetes API server as it may be of some sensitive information.

API Server

Kubernetes, an API server implements all the operations on cluster using distinct tools and libraries which can readily communicate. Kubeconfig is used to expose Kubernetes API, comes with the server side tools and can be used for communication.

Controller Manager

This function of this component is to regulate the state of the clusters and perform a task and is mostly for collectors. It runs in a non terminating loop and is responsible for sending and collecting information to API server. To bring the server to desired state, it collects shared data and make changes. Its key controllers include replication controller, namespace controller, service account controller and endpoint controller. The controller manager runs distinct kinds of controllers to handle nodes, endpoints etc.

Scheduler

Being one of the key components of Kubernetes master, it is responsible for workload distribution and for tracking work utilization load on cluster nodes and then placing them on the available resources by accepting the workload. In short, it is responsible for allocating pods to available nodes and is responsible for workload utilization.

Components of Kubernetes Node

Following are the key components of Node server that are necessary to communicate with Kubernetes master.
Docker - Docker being the primary requirement of any node helps in running any encapsulated application containers and lightweight operating environment.

Kubelet Service - The service in each node is responsible for relaying information both to and from the control plane by interacting with etcd store to read the values of configuration and wright. It assumes the responsibility in maintaining work state and the node, also manages network rules, port forwarding, etc.

Master Components of Kubernetes

Kubernetes Proxy Service - This is a proxy service that runs on nodes and helps in making services that are available to external host. It is responsible for forwarding request to correct containers and performs primitive load balancing and ensures that the networking environment is accessible, predictable as well as isolated. Any key function of this is to manage secrets, pods on node, volumes, new container creation, etc.

Setting Kubernetes - It is necessary to set up a virtual Data Center(VDC) for setting up Kubernetes, which can be considered as a set of machines responsible for communicating each other via the network.

Once the IaaS setup on any cloud is complete, you need to configure the Master and the Node.

After setting up the IaaS on any cloud, configuring  the Master and the Node should be done.

Prerequisites

Docker Installation − Docker is necessary for every Kubernetes installation. Steps to install the Docker are as follows:
Step 1 − Log on to the machine with login credentials of root user.
Step 2 − Using an apt package, update the package information
Step 3 − Run the following commands.

Steps to install the Docker

Step 4 − Add the new GPG key.

Add the new GPG key

Step 5 − Update the API package image.

$ sudo apt-get update

After completing the above tasks, start with the actual Docker engine installation by verifying the kernel version

Docker Engine Installation
Run the following commands to install the Docker engine.

Step 1 − Logon to the machine.
Step 2 − Index package updating.

$ sudo apt-get update
Step 3 − Using the following command, update the information.

$ sudo apt-get install docker-engine
Step 4 − Start the Docker daemon.

$ sudo apt-get install docker-engine
Step 5 − Using the below command, verify the installation of Docker engine.

$ sudo docker run hello-world
Install etcd 2.0

Run the commands following in or to install Kubernetes Master Machine.

Install Kubernetes Master Machine

In the above set of command −
After downloading the etcd, Save it with a specified name and then un-tar the tar package.
Make a dir. Within the /opt named bin and then copy the extracted file to the targeted location.
Now, we can build Kubernetes by installing it on all the machines on the cluster.
Build Kubernetes by installing machines on the cluster

The above command will create a _output dir in the root of the kubernetes folder. Now, we have to extract the directory into any of the directory of our choice /opt/bin, etc.
Networking part is the next coming one need to step up with the Kubernetes master and node setup. To make this, making an entry in the host file has to be done on the node machine.

Kubernetes master and node setup

Following will be the output of the above command.

Output
Now, actual configuration starts on Kubernetes Master.

Start with  copying all the configuration files to their correct location.

copying all the configuration files

The above command will copy all the configuration files to the required location. Now we will come back to the same directory where we have built the Kubernetes folder.

built the Kubernetes folder

The next step is to update the copied configuration file under /etc. dir.

Configure etcd on master using the following command.

$ ETCD_OPTS = "-listen-client-urls = http://kube-master:4001"

Deploying an Application using Kubernetes

To deploy an application in Kubernetes, Kubeapps is the easiest and quick way. It is the dashboard of Kubernetes that supercharges cluster with simple browse and app deployment in any format. It also provides a complete application delivery environment to empower users to launch, review and share applications. Kubeapps is an open-source project designed to encourage to check out the latest version. It can be deployed in cluster in minutes.

Kubeapps

Project in the Kubeapps includes the following:

CLI

This is mostly used to supercharge the cluster and bootstrap kubeapps to run Kubeapps CLI tool in the terminal window. The complete application delivery environment can be installed with a single command.

Dashboard

For Simplified deployment, Kubeapps provides an in-cluster toolset of over 100 kubernetes ready applications that are packaged as Helm charts and kubeless functions.

Hub

This is an web based community designed to discover, rate and review pre-packaged kubernetes applications, which are accessible  with kubernetes cluster.

Why Kubernetes

Kubernetes at a minimum can Schedule and run utility packing containers on clusters of each bodily and digital machines. but, it additionally permits builders to ‘cut the cord’ to bodily and digital machines, transferring from a number-centric infrastructure to a field-centric one providing several advantages that  inherit to containers. It provides the infrastructure required to build a complete container-centric development environment. Kubernetes comes with an underlying technology to Docker,that has already baked into the Linux Kernel for some time. 

Kubernetes allows users to deploy cloud native applications and manage them exactly according to their requirement anywhere and at every point of time. Its key features include:

* An Infrastructure framework for today
* Modularity for better Management
* Updating and Deploying software for Scale
* Laying a strong foundation for Cloud-native apps

In addition to these, Kubernetes allows users to derive maximum container utility and build cloud-native applications thus enable to run independent of cloud-specific requirements anywhere. Clearly, it is the most effective model for application development and operations in a quick and easy way.

 


Subscribe For Free Demo

Free Demo for Corporate & Online Trainings.