DEV Community

Cover image for Kubernetes, minikube ,nodes and pods
Mansoor Ahmed
Mansoor Ahmed

Posted on

Kubernetes, minikube ,nodes and pods

Minikube
Kubernetes architecture contains Master node and worker nodes. Minikube may be a tool that creates it eary to run kubernetes locally.Minikube runs one node kubernetes cluster on your laptop to use kubernetes for practice or development.To start kubernetes cluster using minikube.

Nodes
Group of server is named a cluster.Kubernetes cluster is consists of master node and worker nodes.Master node act as a manager.Worker nodes are server or system on which kubernetes deploys and run our applications.To list down nodes in kubernetes cluster. you’ll use kubectl ge no command.

Pods
To run your application on kubernetes most elementary condition is your application should be containerized.But kubernetes don’t deploy your app’s container directly like docker does.Instead, Kubernetes wraps our app container or group of container together.This container wraper is named a Pod.

Each pod is sort of a separate logical machine with its own IP,host name,processes, and so on,running one application.All the containers during a pod will appear to be running on an equivalent logical machine.A pod with multiple container will always run on a same worker node.
Why pods?

Why can we even need pods?

Why can’t we use containers together?

As we aren’t alleged to group multiple processes into one container.We will be needing another higher-level construct which will allow you to bind containers together and manage them as one unit.

Why would we even got to run multiple containers together?

You may have a supporting container together with your main application container.For example a log collection, network proxy etc

Can’t we put all our processes into one container?

Yes we will that, but we do not .We attempt to divide our application in smaller micro services.This makes our app’s smaller in size fast to load.

About Pods isolation
A pod of containers allows you to run closely related processes together.
Kubernetes provide these containers with(almost) an equivalent environment as if they were all running during a single container,while keeping them some what isolated.
“Some one isolated”, this is often because you would like containers inside each group to share certain resources,although not all,so that they are not fully isolated.
for instance if your main application’s container write logs in some file and you would like another application to use some a part of that log file and make some report.
because of Kubernetes which provides volume concept by which we will share files directories between containers with within the pods.
this is often also one among the rationale why pods having multiple container doesn’t cover different nodes.They always co-located on same worker node.
Some like Dockers,in Kubernetes all containers during a Pod also uses same IP but different port numbers.
Port conflicts if same port number allocated only concerns containers within the same pod.
Containers of various pods can never run into port conflict, because each pod features a separate port space.

Kubernetes Best Practices
Try avoid using latest tag instead use proper tags.
Image pull policy should be used wisely.
If the image pull policy is inf Not Present and you push updated image with an equivalent previous tag,container won’t updated because it will find image already present so won’t pull again.
If the image Pull Policy is usually it’ll pull image whenever pod instance will created,this will hamper the initialization phase of container.
Using multi-dimensional rather than single-dimensional labels.

-Don’t forget to label all of your resources,not only Pods.Make sure you add multiple labels to every resource,so they are often selected across each individual dimension.

Labels may include things like

The name of the application(or perhaps micro service) the resource belongs to Application tier(front-end,back-end,and so on)
Environment (development,QA,staging,production,and so on)
Version
etc

Making manageable container images: Only needs files and dependencies to feature in image file should be added.
Describing each resource through annotations.
to feature additional information to your resources use annotations.
At the smallest amount include annotation describing the resource and with contact information of the author for it.
For more details visit:https://www.technologiesinindustry4.com/2020/09/minikube-nodes-and-pods.html

Discussion (0)