Kubernetes Cluster Setup on Ubuntu 20.04

Kubernetes introduction

Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation.

We have few docker orchestration tools and cloud services in the market as listed below. Amazon ECS The Amazon EC2 Container Service (ECS) supports Docker containers and lets you run applications on a managed cluster of Amazon EC2 instances. Azure Container Service (ACS) ACS lets you create a cluster of virtual machines that act as container hosts along with master machines that are used to manage your application containers. Cloud Foundry’s Diego Diego is a container management system that combines a scheduler, runner, and health manager. It is a rewrite of the Cloud Foundry runtime.

We have few docker orchestration tools and cloud services in the market as listed below. Amazon ECS The Amazon EC2 Container Service (ECS) supports Docker containers and lets you run applications on a managed cluster of Amazon EC2 instances. Azure Container Service (ACS) ACS lets you create a cluster of virtual machines that act as container hosts along with master machines that are used to manage your application containers. Cloud Foundry’s Diego Diego is a container management system that combines a scheduler, runner, and health manager. It is a rewrite of the Cloud Foundry runtime.

Why Kubernetes?

Among all of them we are focusing on Kubernetes in this tutorial because of below mentioned reasons • Kubernetes is google’s own project which they used to managed containers from past 10 years. So, huge applications experience and mature model is something we look for productions. • Kubernetes is ranked among the best Container Orchestration tool in the market as per survey. • It supports other container platform apart from docker like RKT. • Kubernetes is an open source project, its distinct from other “vendor-driven” project like Swarm, Mesos, CloudFoundry. Docker swarn is also open source but its tightly integrated with other Docker tools.

What is Kubemetes?

Ansible can control large number of servers and eases administration and operations tasks. Ansible can do simple configuration management and complex orchestration, it has all the features that config tools have plus it’s very easy to learn and implement. It communicates over normal SSH channels in order to retrieve information from remote machines, issue commands, and copy files. For windows node it uses winrm.

Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container- centric infrastructure. With Kubernetes, you can quickly and efficiently respond to customer demand: • Deploy your applications quickly and predictably. • Scale your applications on the fly. • Roll out new features seamlessly. • Limit hardware usage to required resources only.

Kubemetes Detailed Setup & Exercises

Minikube setup locally. What Is Minikube? Minukube runs a single node kubernetes cluster inside a VM on your laptop. It’s for learning and testing kubernetes, should not be used in production.

Kubenetes goal is to foster an ecosystem of components and tools that relieve the burden of running applications in public and private clouds. Kubernetes is: • Portable: public, private, hybrid, multi-cloud • Extensible: modular, pluggable, hookable, composable • Self-healing: auto-placement, auto-restart, auto-replication, auto-scaling Google started the Kubernetes project in 2014. Kubernetes builds upon a decade and a half of experience that Google has with running production workloads at scale, combined with best-of-breed ideas and practices from the community

Setup Minikube.

Minikube can be downloaded from its github repo. https://github.com/kubernetes/minikube/releases

 curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=docker

Kubectl

kubectl is a command line interface for running commands against Kubernetes clusters. Installing And Setting Up Kubectl Check the download page for the latest release

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"

Validate the kubectl binary against the checksum file:

echo "$(<kubectl.sha256) kubectl" | sha256sum --check

If valid, the output is:

kubectl: OK

Kubectl will read the configuration from .kube/config and will know the IP, Port, Auth other details to connect to kubenetes cluster.

Run kubectl command to verify if it’s working.

chmod u+x kubectl && sudo mv kubectl /usr/local/bin/

Create a sample deployment and expose it on port 8080:

kubectl create deployment balanced –image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment balanced –type=LoadBalancer –port=8080

http://192.168.49.2:31801/

That shows our kubernetes cluster is working, we are able to pull images and run a container and also access its service. If you want to stop your cluster you can run minikube stop and it will bring down minikube cluster.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x