Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Helm Deployment vs Service

I am trying to understand k8s and helm.

When I create a helm chart, there are 2 files: service.yaml and deployment.yaml. Both of them have a name field.

If I understand correctly, the deployment will be responsible for managing the pods, replicasets, etc and thus the service.

Basically, why am I allowed use a separate name for the service and for the deployment? Under what scenario would we want these 2 names to differ? Can a deployment have more than 1 service?

like image 947
Ufder Avatar asked Aug 04 '18 22:08

Ufder


People also ask

What is Helm deployment?

Helm is a Kubernetes deployment tool for automating creation, packaging, configuration, and deployment of applications and services to Kubernetes clusters. Kubernetes is a powerful container-orchestration system for application deployment.

What is deployment and service in Kubernetes?

What's the difference between a Service and a Deployment in Kubernetes? A deployment is responsible for keeping a set of pods running. A service is responsible for enabling network access to a set of pods. We could use a deployment without a service to keep a set of identical pods running in the Kubernetes cluster.

What is difference between Kubernetes and helm?

With this analogy, think of the Kubernetes cluster as an OS; Helm is the tool that enables users to install an application on that Kubernetes cluster. Helm is a packaging format that works well with simple applications like stateless microservices and REST-based APIs with states stored externally in the cloud.


Video Answer


1 Answers

The "service" creates a persistent IP address in your cluster which is how everything else connects it. The Deployment creates a ReplicaSet, which creates a Pod, and this Pod is the backend for that service. There can be more than 1 pod, in which case the service load balances, and these pods can change over time, change IP's, but your service remains constant.

Think of the service as a load balancer which points to your pods. It's analogous to interfaces and implementations. The service is like an interface, which is backed by the pods, the impementations.

The mapping is m:n. You can have multiple services backed by a single pod, or multiple pods backing a single service.

like image 169
Marcin Romaszewicz Avatar answered Jan 03 '23 06:01

Marcin Romaszewicz