Learn How Kubernetes Help The Companies To Scale-Up.

ScriptBees
Nov 1 · 5 min read

Kubernetes

Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit. Kubernetes allows you to deploy containerized applications to a cluster without tying them explicitly to individual machines. With the new model, applications need to pack in a way that decouples them from individual hosts: they need to containerized. Containerized applications are more flexible and available than in past deployment models, where applications were installed directly onto specific machines as packages deeply integrated into the host. Kubernetes automates the distribution and scheduling of application containers across a cluster in a more efficient way.

Kubernetes consists of 2 resources.

· Master — Coordinates the cluster

· Nodes — Workers that run applications

Kubernetes Components and Architecture

Kubernetes follows a client-server architecture. The master server consists of various components, including a Kube-apiserver, etcd, storage, Kube-controller-manager, a cloud-controller-manager, a Kube-scheduler, and a DNS server for Kubernetes services. Node components include kubelet and kube-proxy on top of Docker.

Master Components

  • Controller — A kube-controller-manager daemon, in a nutshell, a set of infinite control loops that transfers in a single binary for simplicity.
  • api-server — It is a service that ties everything together, a front-end of REST API of the cluster that receives a manifest to create, update, and delete API objects like services, pods, so on.
  • Scheduler — This schedules our newly created pods to nodes with sufficient space to satisfy the pods’ resource needs.

Node Components

  • kube-proxy — It is a network daemon which orchestrates the Service VIP management on every node
  • kublet — It is a primary node that runs on each node, which can register the node with api-server using a hostname, a flag to override hostname or a cloud provider.

A line tool — kubectl interacts with a kube-apiserver and sends commands to the master node where each command converts into an API call.

Availability

Kubernetes is available with different cloud platforms (GCP, AWS, Azure, Oracle) and can run locally using minikube. Minikube runs on a single-node Kubernetes cluster inside a Virtual Machine on our PC.

Creating Kubernetes Services

Kubernetes Services can run on different scenarios as:

  1. Manual — By logging into the Portal, we can choose the Kubernetes services from the available versions and regions followed by creation.
  2. CLI (Command Line Interface) — We need to install respective Cloud-Based CLI to create Kubernetes services.
  3. Terraform Scripts — For automating the entire Kubernetes service infrastructure.

We, ScriptBees, prefer Terraform since it is a tool to build, change, and version the infrastructure safely and efficiently.

To communicate with the Kubernetes cluster, we need to install kubectl — A line tool that interacts with a kube-apiserver and sends commands to the master node where each command converts into an API call.

Most common operations can do with the listed kubectl commands:

kubectl get — list resources

kubectl describe — show detailed information about a resource

kubectl logs — print the logs from a container in a pod

kubectl exec — execute a command on a container in a pod

We can use these commands to see when the applications deployed, what their current statuses are, where they are running, and what their configurations are.

For Eg, kubectl get nodes command is used to check whether the nodes are available or not.

Application Deployment

Here, we have a build ready Application in the name of “nginx-deployment.”

Create the deployment by running the following command:

A few seconds later, the output is similar to:

To check the Pods:

To see the replicaset created by the deployment:

Expose deployment:

$ kubectl get nodes -o wide

-o wide displays the node information with node_ip

Now, access the deployed application using curl

Curl http://node_ip:nodeport (eg: http://192.168.99.51:30512)

To check the Nginx-deployment logs:

Cleanup:

To delete the three replicated containers, delete the deployment:

Conclusion

Using Kubernetes is an excellent way to get started and easily demonstrate running an application on Kubernetes. With the continued hype followed on Kubernetes in the development community, more companies are upgrading to Kubernetes regularly. In spite, Kubernetes became an economic powerhouse with the various benefits that it offers. It can work in both public and private sectors with the favorite tools that chose with even with hybrid clouds.

ScriptBees provides the Kubernetes services based on the cloud requirement selected by the Client, including the infrastructure.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade