Enable Dark Mode!
what-is-kubernetes-how-to-install-kubernetes-in-local-ubuntu-20-04.jpg
By: Mohd Shamsad PS

What is Kubernetes? How to set up Kubernetes in local ubuntu 20.04.5?

Technical

Kubernetes is an open-source system for automating the deployment, scaling, and management of containerized applications. It is also known as k8s. It will assist in deploying containerized applications and managing containerized applications. The main difference between docker and Kubernetes is in Kubernetes. It can communicate between different containers, while docker cannot. The main feature of Kubernetes is scaling the resource. We can set the minimum and maximum resources (CPU and memory).

Cluster:
It contains a set of nodes that run containerized applications.
Node: 
A node is a Virtual Machine or Physical Machine depending on the cluster. Previously it is known as a minion.
Pod:
Pods are the smallest objects in Kubernetes. It is similar to a set of containers.
Replica set:
It is used to make sure the availability of a specified number of pods.
Minikube:
It is a tool that helps to run Kubernetes locally. It runs a single-node Kubernetes cluster on a PC. Thus we check our development works. It creates a Virtual machine local and deploys a cluster containing one node. In order to install the minikube, we need two CPUs or more, two GB of free memory, 20GB of free hard disk space, an internet connection, a container, or a VM manager.
In order to install minikube locally, we can run the following command line in the terminal.
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Then the latest minikube version will be installed in our local. To start minikube, we have to run the command:
minikube start
To pause the minikube, we have to run the command: 
minikube pause

To stop the minikube, we have to run the command:

minikube stop
Kubectl:
Kubernetes command line tool (kubectl) allows to run command lines against the clusters. Kubectl helps to deploy, manage and inspect resources and view logs. It is a command line tool to communicate with the cluster control plane.
In order to download kubectl, we have to run the following command in the terminal:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Installing a specified version replace the $(curl -L -s https://dl.k8s.io/release/stable.txt) and specify the version as shown below:
curl -LO "https://dl.k8s.io/release/$(curl -LO https://dl.k8s.io/release/v1.25.0/bin/linux/amd64/kubectl)/bin/linux/amd64/kubectl"
Now install the kubectl using following command:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

Basic kubectl commands:

kubectl get pod

This command is used to get the details of pods in our cluster. If we want to know the details of a specified pod, then mention the pod name after this command.

Kubectl get pod -o wide

This command is used to gather more information about the pods.

kubectl apply -f [file name]

This command line is used to apply configuration changes to a resource from a file.

kubectl logs [pod name]

This command is used to get the log of the corresponding pod.

kubectl replace -f [file name]
This command is used to replace a resource from a file.
kubectl options

This command is used to list the global command line, which applies to all commands.

kubectl cluster-info

This command is used to display endpoint information of master and service in the cluster.

kubectl get node

This command is used to get the details of nodes.

kubectl get node -o wide

This command is used to get more information about the node

kubectl cp [file source] [file dest]

This command is used to copy a file from source to destination.

kubectl create -f [file name]

This command is used to create a resource from a file

kubectl edit -f [file name]

This command is used to edit and update the definition.

kubectl delete -f [file name]

This command is used to delete a resource from a file.

kubectl api-resources

This command is used to get the complete list of supported resources.

Kubectl describe [type]

This command is used to get the detailed state of one or more resources.

To deploy an application

kubectl create deployment hello-minikube --image=docker.io/nginx:1.23
kubectl expose deployment hello-minikube --type=NodePort --port=80

By running this command we can create a sample deployment in Kubernetes and expose it to port 80.

minikube service hello-minikube

By running this command, our browser will open the service hello-minikube.

These are some basic commands in kubectl. In order to run kubectl in our local, we need to configure a minikube that acts as a Kubernetes. Then we can deploy resources to Kubernetes and check our development works.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message