How to start with Kubernetes for begginer
Tags: kubernetes, docker, microservices, python
Published: 2021-08-29 06:22:12

Prior knowledge require: Python or any other language development knowledge. Knows about what is GIT and how it works. Good if you know about Docker.

What can Kubernetes do for you?

With modern web services, users expect applications to be available 24/7, and developers expect to deploy new versions of those applications several times a day. Containerization helps package software to serve these goals, enabling applications to be released and updated in an easy and fast way without downtime. Kubernetes helps you make sure those containerized applications run where and when you want, and helps them find the resources and tools they need to work. Kubernetes is a production-ready, open source platform designed with Google’s accumulated experience in container orchestration, combined with best-of-breed ideas from the community.

So in short, when you need to run your application all round the clock. You need to deploy and update release your application any time or several times. Then Kubernetes comes to rescue it. And now most of the cloud hosting supports it and very easy to deploy as well.

Kubernetes is an open-source platform for automating deployment, scaling, and operations of application containers across clusters of hosts, providing container-centric infrastructure.

The Kubernetes Master is a collection of three processes that run on a single node in your cluster, which is designated as the master node. Those processes are: kube-apiserver, kube-controller-manager and kube-scheduler.

Each individual non-master node in your cluster runs two processes:

kubelet, which communicates with the Kubernetes Master.
kube-proxy, a network proxy which reflects Kubernetes networking services on each node.

The basic Kubernetes objects include:

Pod
Service
Volume
Namespace
Kubernetes Master

The Kubernetes master is responsible for maintaining the desired state for your cluster. When you interact with Kubernetes, such as by using the kubectl command-line interface, you're communicating with your cluster's Kubernetes master.

![Kubernetes master](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7shryggemyryra4zcprv.jpeg)

Kubernetes Nodes

The nodes in a cluster are the machines (VMs, physical servers, etc) that run your applications and cloud workflows. The Kubernetes master controls each node; you’ll rarely interact with nodes directly.

What is container

Containers are a technology for packaging the (compiled) code for an application along with the dependencies it needs at run time. Each container that you run is repeatable; the standardization from having dependencies included means that you get the same behavior wherever you run it.

What is container image

A container image is a ready-to-run software package, containing everything needed to run an application: the code and any runtime it requires, application and system libraries, and default values for any essential settings.

What is container runtime

The container runtime is the software that is responsible for running containers.

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

Master
Manage, build, deploy and operate

Node

Run containers and registries

Let see how to install and run in local system
I am using Ubuntu you can use any linux.

Steps

Installing kubectl

Download a pre-compiled release[1] and unzip it — — kubectl should be located in the
platforms/<os>/<arch> directory.

[1] https://github.com/kubernetes/kubernetes/releases
Add kubectl to your path. Note, you can simply copy it into a directory that is already in your $PATH (e.g. /usr/local/bin).

For example:

`$ sudo cp kubernetes/platforms/linux/amd64/kubectl /usr/local/bin/kubectl`

You also need to ensure it’s executable:

`$ sudo chmod +x /usr/local/bin/kubectl`

administration

To administer and interact with any given Kubernetes cluster (local or remote), you must set
up your kubeconfig file. By default, kubectl configuration lives at

`$ ~/.kube/config`

You can also create a cluster in your local machine via Minikube (See section 3: Running Locally via Minikube)

![code block](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e6kuxtz4l0ztlhl0rxmx.png)

Prerequisit for minikube

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS on all platforms.

For example:

`$ cat /proc/cpuinfo | grep ‘vmx\|svm’`

Make sure if the setting is enabled where this command should output something.

Install an x86 virtualization software package in your local machine:

Linux: The latest VirtualBox

Install minikube

Feel free to leave off the sudo mv minikube /usr/local/bin if you would like to add minikube to your path manually.

`$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.12.2/minikube-
linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/`

Install kubectl

You will need to download and install the kubectl client binary to run commands against the
cluster. For example:

`$ curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release/v1.3.0/bin/
linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/`

Getting started

Note that the IP below is dynamic and can change. It can be retrieved with minikube ip.

![code block](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10zhjirgbnv6kdifvl5w.png)

##To access the Kubernetes Dashboard, run this command in a shell after starting minikube to get the address:

`$ minikube dashboard`
`$ minikube stop`

Stopping local Kubernetes cluster…
Stopping “minikube”…

kubectl CLI

kubectl [command] [TYPE] [NAME] [flags]

Viewing, Finding Resources

##Get commands with basic output

`$ kubectl get pod`

![code block](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4pdun6sukqkb1edlk700.png)

To know more about the usage kindly visit 
[Link](https://kubernetes.io/)

To know how to use Kubernetes in Google Cloud

[Link](https://cloud.google.com/kubernetes-engine)

To know how to use Kubernetes in AWS

[Link](https://aws.amazon.com/eks/?nc2=h_ql_prod_ct_eks)

Thanks