Basic kubernetes
Published: 2022-10-27 21:19:52

Kubernetes is a container orchestrator. Seeing the need for high scalability, kubernetes sees itself necessary, imagine the situation of having to manage many docker containers, kubernetes does it for you.

## Configmap

Configmap is a file that injects configuration data into the container.

Basically, configmap is a single configuration file for more than one container, making it easier for you not to have the need to configure containers one by one.

## Secrets

The secret saves password in kubernetes and retrieves it inside the container.

## Load Balancer

Load balancer and a load balancer. It balances the load level between the containers so they don't get overloaded.

## Service Discovery

Service discovery has a record of all containers and together with the load balance it delegates to which container the mass of data will go, its priority and the container that is healthier.

## POD

POD is a unit, a wrapper that seals a container, ie the POD it wraps a container and seals it. By default a POD will always have a container inside, but there may be exceptional cases where you have more than one container inside a POD, but this is not advisable.

The POD it checks if the container is with enough quality to run the container.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0s7u8et5tjy540xbt3es.png)

## ReplicaSet

The replicaset monitors the number of POds that are in the air at all times.

The replicaSet can be configured for example to run two PODs at all times, if a POD dies, the replicaSet will replicate that POD again from scratch.

The replicaSet also stores the container version.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eapz8ptj3c4c0iz9mud3.png)

## Deployment

On top of the replicaSet we have the deployment. The deployment it guarantees that it can generate a new version, it also guarantees the replicaSet, it has the replicaSet inside that guarantees the amount of replica PODs.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a03rcd5wr39jgpnez5pe.png)

## Service

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q0h7mhcgrns8qftf91cc.png)

The service makes it possible for other people or systems to access the deployment, thereby accessing the PODs. It is external to the deployment.

In the service, a configuration is made from a label called ***selector***.

An example of this is that the selector can be called ***app:front*** or ***app:back***. That way we can diversify the selector for a front end or back end application for example.

NOTE: Each deployment will have its service.

Using the service, there are a few possibilities:

 - Generate an internal ip.
 - Generate an external ip, for external access.
 - Provide a door.

***Round-robin*** is a randomization algorithm that works in conjunction with service.

## Running local kubernetes with kind

Kind simulates a Kubernetes cluster using

[auxiliary material
](https://spacelift.io/blog/kubernetes-tutorial)

<br />

[![Texto alternativo da imagem](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ds4alkts3uxq0dsco0nv.png))](https://www.linkedin.com/in/israel-lopes-419a32189)