SERVICIOS y LOAD BALANCERS en KUBERNETES

Pelado Nerd
7 Jan 201909:47

Summary

TLDRThe video script discusses the process of setting up a cluster and deploying posts using Kubernetes. It explains different types of services, including NodePort, ClusterIP, and LoadBalancer, and how they are used to access applications within a cluster. The script also covers the dynamic nature of pods, the creation of a WordPress service, and the use of external IPs for accessing services. It highlights the importance of load balancers for maintaining a consistent IP address and ensuring high availability, even when pods are destroyed and recreated.

Takeaways

  • 😀 The script discusses learning to set up one's own cluster and deploying posts.
  • 💡 It introduces the concept of services within a cluster and their different types.
  • 🔧 The script explains how to create load balancers automatically using cloud services.
  • 📈 It highlights the dynamic nature of pods, which can be recreated with new IPs if they die.
  • 🌐 Discusses the use of services to route traffic to pods based on labels or tags.
  • 🚀 Demonstrates how to create a service with a fixed IP within the cluster for internal access.
  • 🌐 Explains the use of NodePort services to expose applications on a specific port on each node's public IP.
  • 🔄 Covers the creation of LoadBalancer services that integrate with cloud providers to manage external access.
  • 🛠️ The script touches on the automation of service creation and how it simplifies the management of dynamic infrastructure.
  • 📝 It concludes by emphasizing the ease of managing services with Kubernetes, including the ability to create and delete them without manual intervention.

Q & A

  • What is the purpose of creating a cluster in the context of the video script?

    -The purpose of creating a cluster is to support the deployment of applications and services, ensuring they can scale and be managed more efficiently.

  • What does the term 'service' refer to in the script, and why is it important?

    -In the script, a 'service' refers to a Kubernetes resource that defines a logical set of pods and a policy by which to access them. It's important because it enables communication between different parts of an application and provides a way to access them consistently, regardless of the underlying pods' lifecycle.

  • What is the issue with using NodePort for accessing services in a cluster?

    -The issue with NodePort is that it requires pointing to the public IP of each worker node to reach a specific port, which is not ideal for maintaining a stable access point as pods can be rescheduled or recreated on different nodes.

  • How does a ClusterIP service differ from a NodePort service?

    -A ClusterIP service is accessible only within the cluster, providing a stable IP address that remains the same regardless of the pods it targets, whereas a NodePort service is accessible from outside the cluster by directing traffic to a specific port on each worker node.

  • What is the role of a LoadBalancer service in Kubernetes?

    -A LoadBalancer service in Kubernetes connects to the cloud provider's API and creates an external load balancer that distributes traffic across all worker nodes, providing a stable external IP for accessing the application.

  • Why might a service be unable to access a backend if the backend's IP changes?

    -If the backend's IP changes, any service that is not configured to handle dynamic IP assignments will be unable to access it, as it will still be trying to connect to the old IP address.

  • What happens when a pod is destroyed in Kubernetes?

    -When a pod is destroyed, it is removed from the cluster, and its IP address is no longer available. If a service was pointing to that pod, it would need to be updated to point to a new pod with a new IP address.

  • How can a service ensure it always points to the correct backend, even if the backend's IP changes?

    -A service can ensure it always points to the correct backend by using a selector that targets the appropriate labels on pods, allowing it to redirect traffic to any pod that matches those labels, regardless of IP changes.

  • What is the significance of using a DNS name to access a service in Kubernetes?

    -Using a DNS name to access a service allows for a more flexible and stable access point, as the DNS resolver will automatically direct traffic to the correct service IP, even if the underlying pods or their IPs change.

  • How can one view the list of services in a Kubernetes cluster?

    -One can view the list of services in a Kubernetes cluster by using the command `kubectl get services`, which will display the services along with their types and cluster IPs.

  • What does the script suggest about managing services and pods in Kubernetes?

    -The script suggests that Kubernetes manages services and pods dynamically, allowing for the creation, destruction, and rescheduling of pods without affecting the stability of the services that rely on them.

Outlines

00:00

🤖 Deploying and Managing Cluster Services

This paragraph discusses the process of deploying a self-hosted cluster and the intricacies of managing services within it. The speaker explains the initial learning curve and cost involved in setting up a cluster, and then delves into the concept of services, their types, and how to create and manage them. The explanation includes the use of 'NodePorts' for internal access, the dynamic nature of pods, and the creation of a service to provide stable access to applications within the cluster. The paragraph also touches on the challenges of using public IPs for external access and introduces the idea of using 'LoadBalancer' services for cloud provider-managed load balancing.

05:00

🌐 Advanced Service Configurations and Load Balancing

The second paragraph focuses on advanced configurations for services within a cluster, particularly on the use of 'LoadBalancer' services. It explains how to create a 'LoadBalancer' service that connects to the cloud provider's API to manage external traffic. The speaker provides a step-by-step guide on verifying the creation of the load balancer through the web interface and emphasizes the importance of persistent IP addresses for stable access to services. The paragraph also covers the automatic handling of service creation and destruction, ensuring that the load balancer always directs traffic to the correct nodes, even when pods are destroyed and recreated. Additionally, it mentions the possibility of adding further configurations such as certificates and health check rules to enhance service security and reliability.

Mindmap

Keywords

💡Cluster

A cluster in the context of the video refers to a group of computers working together closely so that they can be viewed as a single system. It is central to the video's theme as it discusses setting up and deploying applications within a cluster environment. For example, the script mentions 'levantar nuestro propio clúster' which translates to 'lifting our own cluster', indicating the process of setting up a cluster.

💡Service

In the script, a 'service' is a Kubernetes resource that defines a logical set of pods and a policy by which to access them. It is a fundamental concept in the video, as it discusses different types of services and how they can be used to maintain access to applications even if the underlying pods change. The term is used when explaining 'no port' services, which create a specific port that points to the service on each pod.

💡Pod

A pod is the smallest deployable unit in Kubernetes and can be thought of as a wrapper around a container. The video discusses the dynamic nature of pods, which can be created, destroyed, and recreated as needed. This is illustrated when the script mentions that if a pod 'muere' (dies), it does not 'resucitan' (resurrect), but a new one can be created.

💡Deployment

A deployment in Kubernetes is a way to declare the desired state of a set of pods. The video touches on the deployment of applications within a cluster, emphasizing the need for a deployment controller to manage the pods. The script refers to 'desplegar los posts', which means deploying the pods, as part of setting up the cluster.

💡Load Balancer

A load balancer is a service that distributes network or application traffic across multiple servers. The video explains how to create a load balancer service in Kubernetes, which connects to the cloud provider's load balancer to manage traffic to the pods. The script mentions 'load balance' as a type of service that can be created, which is crucial for maintaining access to applications as pods are dynamically managed.

💡IP Address

An IP address is a unique identifier for devices on a network. The video discusses the importance of IP addresses in accessing services within a cluster, both internally and externally. The script mentions 'IP pública' (public IP) and 'IP interna de la red de los bots' (internal IP of the bot network), highlighting the use of IP addresses for service access.

💡DNS

DNS, or Domain Name System, is the system that translates human-friendly domain names into IP addresses. The video mentions DNS in the context of resolving service names to their corresponding IP addresses within a cluster. The script refers to 'dns de gobernantes', indicating the use of DNS for service discovery.

💡Kubernetes

Kubernetes is an open-source platform for managing containerized workloads and services. The video's theme revolves around using Kubernetes to create and manage clusters, services, and deployments. The script uses terms like 'kubectl', which is a command-line tool for interacting with Kubernetes clusters, indicating the use of Kubernetes throughout the video.

💡Controller

In Kubernetes, a controller is a control loop that watches the state of the cluster and makes changes to move the current state towards the desired state. The video discusses the role of controllers in managing the lifecycle of pods and services. The script mentions 'replaciendo el controller', which refers to the process of a controller managing the replacement of pods.

💡Cloud Provider

A cloud provider is a company that offers cloud services, such as computing power, storage, and databases. The video mentions connecting to a cloud provider's API to create load balancers, indicating the integration of Kubernetes with cloud services. The script refers to 'proveedor de nube', which is essential for setting up external access to services within the cluster.

💡Persistence

Persistence in the context of the video refers to the ability of a service to maintain its state or IP address even when the underlying pods are destroyed and recreated. The video discusses the importance of persistence for services, especially when using load balancers. The script mentions that services should maintain the 'misma ip', emphasizing the need for persistent access points.

Highlights

Learning to create your own cluster at a cost of 100 dollars.

Understanding how to support initial posts with an application to control and create a small service.

Explanation of what services are and the different types of services.

Creating balances automatically using Digital Ocean.

Introduction to Kubernetes services and how they work.

The downside of using NodePort services as they require pointing to the public IP from each worker.

How pods are dynamic and can be recreated with new IPs.

Using services to direct traffic based on labels for consistent access.

The creation of a service for WordPress with an internal cluster IP for internal access.

Exploring the use of external IPs and NodePorts for external access to services.

The importance of not relying on the public IP of a node for consistent service access.

Introduction to LoadBalancer services that integrate with cloud providers for external access.

How LoadBalancer services maintain a constant IP while workers can be recycled.

The process of creating a LoadBalancer service and its automatic setup with cloud provider APIs.

Demonstration of destroying and recreating nodes without affecting the LoadBalancer's constant IP.

The ability to add custom settings like certificates and health checks to services.

Automatic management of services including creation and deletion without manual intervention.

The option to create and delete LoadBalancer services and their impact on the application's accessibility.

Transcripts

play00:00

así que triste aprendiendo y creas tu

play00:02

propio clúster me imagino cosas

play00:08

a 100 dólares

play00:11

aprendimos cómo apoyar los primeros

play00:13

posts con la application controlar y

play00:16

crear un pequeño servicio pero no

play00:17

explicamos bien lo que era un servicio

play00:18

luego sabrán de lo que son servicios los

play00:21

diferentes tipos de servicios

play00:23

y vamos a ver cómo crear un los balances

play00:25

automáticamente

play00:27

usando colgantes en digital option

play00:31

mira la intro vive en sólo tienen se lo

play00:34

digo medito realmente lo mismo voy a

play00:35

hacer la intro solo

play00:36

[Música]

play00:44

me trajo 9 4x lm

play00:50

gracias

play00:53

como decía recién hemos aprendido cómo

play00:55

levanta nuestro propio clúster hemos

play00:56

aprendido cómo desplegar los posts ya

play00:59

tenemos el pod corriendo y queremos

play01:01

acceder a ese apodo de la otra vez lo

play01:03

que vimos fue de acceder usando un tipo

play01:05

de servicio que se llama nou porta que

play01:07

básicamente lo que hace es crear un

play01:09

puerto específico que apunta el servicio

play01:12

en cada no lo malo de eso es que tienes

play01:14

que apuntarle al la ip pública desde

play01:17

cada uno de los workers para llegar

play01:19

hacia ese puerto no es una muy buena

play01:21

idea hay mejores formas vamos a

play01:23

plantarles los posts de cuadrantes son

play01:25

mortales se mueren cuando se mueren no

play01:27

vuelven a crecer

play01:30

no resucitan si el replec hecho

play01:33

controller o el de pluma lo reemplaza

play01:35

por otro se crea un nuevo pot con una

play01:37

nueva ip se como puedes ver esos posts

play01:40

son dinámicos o sea se pueden morir se

play01:42

puede ante reductor nuevo se puede mover

play01:43

otro nodo usar el ipad del post para

play01:47

llegar a ese punto es una buena idea

play01:48

qué pasa si tenemos por ejemplo un front

play01:51

end yumba que ni queremos desde el front

play01:53

el apuntarle al back-end para acceder a

play01:55

un servicio algo así

play01:57

si nosotros usamos la ip depot s&p puede

play02:00

cambiar porque es el post tipo de morir

play02:01

y puede crearse otro post entonces no

play02:03

vamos a poder estar accediendo a ese

play02:05

back end de forma

play02:07

constante el cual no tenga cosas que se

play02:09

llaman servicios que son los servicios

play02:11

es una extracción que define un set

play02:14

lógico de posts basado en una política

play02:17

si finalmente esa política es por

play02:19

ejemplo una etiqueta como le ponía cada

play02:20

post entonces el servicio dice tengo que

play02:22

mandar el tráfico a todos los posts que

play02:24

tengan esta etiqueta de esa forma sabe

play02:26

que puedo llegar a hacer un get potts

play02:28

para ver todos los posts que estamos

play02:29

corriendo debe estarle wordpress que

play02:30

creamos la otra vez

play02:32

pero no puedo acceder a ese post porque

play02:35

no hay ningún servicio creado entonces

play02:36

vamos a crear un servicio una vez que

play02:38

queremos el servicio podemos hacer un

play02:41

get sleazy para ver los servicios y

play02:43

fíjate que creó el servicio wordpress y

play02:45

le dio una ip de clúster si a ese

play02:49

servicio en el puerto 80 que quiere

play02:51

decir esto que este servicio solamente

play02:53

puede ser accedido dentro del plástico

play02:55

por ejemplo si está dentro un pot no

play02:57

puedes acceder desde uno porque es un ip

play02:59

interna de la red de los bots esto

play03:01

serviría solamente si yo quiero acceder

play03:03

por ejemplo desde un bot que está en el

play03:05

back end aún porque está en forma de no

play03:07

viceversa y lo que hago es apuntarle a

play03:10

a esta ip de wordpress que siempre va a

play03:12

ser la misma

play03:13

este es el servicio siempre va a ser la

play03:14

misma y va a llegar a los posts basado

play03:16

en las reglas etiquetas

play03:19

también se puede usar el nombre se puede

play03:21

hacer desde cualquier punto le apunta al

play03:24

nombre wordpress y el dns de gobernantes

play03:26

debería resolver el servicio si nos

play03:28

mantenemos en segundo tipo de servicio

play03:29

que es el que creamos la otra vez que lo

play03:31

que hace es crear un puerto en el nodo

play03:33

que accede a

play03:35

entonces

play03:40

y acá ya que ahora va a decir tipo no

play03:43

port sí entonces lo que hace es apuntar

play03:46

el puerto 30.000 en el que apunta al 80

play03:49

del servicio de simon get 'notes - o

play03:52

wire si para traernos la ip pública

play03:55

podemos apuntar a esta ip al puerto

play03:57

30.000

play04:00

y voy a llegar al wordpress perfecto

play04:02

ahora pero sólo un buen lo malo que

play04:03

tiene como decía recién es que tenemos

play04:04

que estar buscando la ip pública del bus

play04:06

del nodo y no es no es muy feliz bueno

play04:09

ahora vamos a ver el tercer tipo de

play04:10

servicio que llama load balance el este

play04:13

servicio lo que va a hacer es conectarse

play04:14

a lápiz del proveedor de nube que tengas

play04:17

que estés usando en tu clúster y va a

play04:19

crear un loop balance en el lado de

play04:21

ellos que lo que son los van a ser los

play04:22

manejadores de carga que va adelante

play04:24

todos los workers y entonces vos tenés

play04:26

que estar aprendiendo te la ip de los

play04:27

workers apuntar tu dns a la ip de

play04:29

externa de cada worker porque acordate

play04:31

que los walker también son descartables

play04:32

son ganados igual apuntada solamente los

play04:35

van a hacer todos los workers van a

play04:37

estar dentro de trajes en los balances y

play04:39

por más que vos recicles esos workers

play04:41

vos simplemente la punta sala los van a

play04:43

ser y vas a llegar siempre a tu

play04:44

aplicación si la sintaxis es bastante

play04:47

simple es simplemente le decís tipo los

play04:49

van a ser el protocolo el por dónde vas

play04:52

a ir si y de nuevo tienes que crear el

play04:54

selector que es la forma en que lo van a

play04:56

hacer sabe a dónde mandar el tráfico

play05:00

tengo mucho como

play05:07

lo que hacemos es asegurarnos que

play05:09

tenemos en el servicio

play05:13

y vamos a aplicar

play05:15

el nuevo y el nuevo los balances que va

play05:17

a ser tipo load o arancel fíjate que si

play05:19

ahora hacemos un get service es decir

play05:21

tipo load a lanzar fíjate que dice

play05:23

externa light vending de nuevo lo que

play05:26

hace esto es conectarse a la api del del

play05:28

proveedor nubes y en este caso existe la

play05:30

opción y pedirle que creó un los

play05:31

balances si vamos a la interfaz web de

play05:34

10 de lo bien y hacemos clic en

play05:35

networking vamos a los balances fíjate

play05:37

que se está creando si un los balances

play05:40

automáticamente desde cuba

play05:42

gracias a que digite elogian provee este

play05:43

este servicio pone desde guantes ya

play05:46

tiene configurados las credenciales para

play05:47

conectarse de la api de y de las jons y

play05:49

si lo creamos a mano alzada un clúster

play05:52

basado en los nuevos tenemos que agregar

play05:54

esas credenciales que lo vamos a ver en

play05:56

otro vídeo por ahora lo importante es

play05:57

que esto ya lo tienes resuelto y lo

play05:59

único que tenemos que hacer es pedirle

play06:00

que creó un servicio tipo los van a ser

play06:02

y automáticamente va a crear un los

play06:04

balances en el proveedor si una vez que

play06:07

se termine de crear si hacemos acá un

play06:09

get service fíjate y ya tenemos la ip

play06:11

externa de este los balances pero ésta

play06:13

es la única ip que no tenemos que

play06:15

acordar o incluso en días de algo ya no

play06:17

puedes crear un dominio de puntal sólo

play06:18

los ghaneses directamente o sea que si

play06:19

se cambia

play06:21

va a tener la no hay p entonces

play06:23

simplemente hacemos clic a s&p y nos

play06:26

trajo de wordpress vamos a probar algo

play06:29

vamos a ir a drop let's sí que son las

play06:31

instancias de dieta low jean-jacques

play06:33

hasta nuestra instancia y vamos a

play06:34

destruirla

play06:37

recordemos que toda la metadata o sea

play06:39

todos los posts todas las de definición

play06:41

de los servicios toda la definición de

play06:42

que necesitamos saber qué contenedores

play06:44

queremos correr todo eso está guardado

play06:46

en los controladores mejor dicho está

play06:48

guardado en la base de datos de los

play06:50

controladores que éste cede y entonces

play06:52

nosotros sin ningún problema deberíamos

play06:54

poder destruir los nuevos pueblos no son

play06:55

ganados son descartables entonces a

play06:58

nosotros destruirlos no obviamente el

play07:00

nuevo nuevo trae una ip diferente pero

play07:02

debería el los van a hacer mantener la

play07:04

misma ip si debería cargar el nodo nuevo

play07:07

dentro de los balances si nos vamos a la

play07:09

interfaz al club city le hacemos un get

play07:11

'notes

play07:13

no hay no porque lo destruir bueno vamos

play07:16

a drop les refrescamos y vemos que ya

play07:17

creó un nuevo fijate que es otro nodo

play07:19

tiene una ip diferente a la que teníamos

play07:21

recién y ahora hacemos un get loud

play07:26

como ver que luego de 77 segundos aún no

play07:30

hacemos un testing de bots

play07:35

debería haberse creado el nuevo por sí y

play07:39

si hacemos un get service debería estar

play07:41

todo como recién y fíjate que la ip es

play07:43

la misma de ración si deberíamos poder

play07:45

refrescar este esta página y debería

play07:49

cargar sin ningún programa afectando

play07:51

entonces que hicimos matamos el nodo y

play07:53

como tenemos un loop van a ser adelante

play07:55

son los sólo podemos acceder e sólo

play07:57

actuarán servir tener que acordarnos de

play07:58

la ip de cada uno de los nodos y poder

play08:01

verles nuestro sitio perfecto y todo

play08:04

esto lo maneja como net es con billete a

play08:06

luchas hay muchas más opciones que

play08:08

nosotros podemos agregar si al archivo

play08:11

éste le podemos agregar por ejemplo

play08:12

certificados le podemos agregar reglas

play08:15

de help cheque todo eso eso es pues

play08:17

vamos a ver más adelante pero lo bueno

play08:19

que nosotros podemos crear nos van a ser

play08:20

sedes de cornetes quienes afectan la

play08:22

nube automáticamente y obviamente si

play08:25

queremos

play08:26

podemos borrar este servicio

play08:30

play08:32

y esto lo que debería hacer es borrar el

play08:35

loto al hacer también fíjate se borró

play08:38

perfecto entonces todo esto lo maneja

play08:40

con arte no queremos estar haciendo nada

play08:41

más no tenés no tenemos concerté reforma

play08:43

o esas cosas para crear este los van a

play08:46

hacer lo maneja automáticamente se borra

play08:47

y se crea solo

play08:49

y bueno

play08:52

para más videos si te gustó

play09:03

a esta altura no esto porque para esto

play09:08

dale no me gusta

play09:12

si el barça dual answers creado un pot

play09:16

con h aproxima

play09:19

y la ventaja no se aproxima

play09:43

[Música]

Rate This

5.0 / 5 (0 votes)

Related Tags
KubernetesClusterDeploymentServicesLoad BalancingDockerNetworkingCloud ProviderDevOpsAutomationTech Tutorial