How to do mulit pods deployment in kubernetes

S Andrew

I have two docker images Mosquitto & user-info. userInfo is a container which performs some logic and then send the result to mosquitto. Mosquitto then use this information to send it to IOT hub. Inside user-info I have mentioned to use hostname=mosquitto so the user-info send all data to mosquitto

I started first by creating a pods with these 2 containers. So I wrote a yaml file with kind: Pod and everything went ok. As these container were inside the same pod, so they were easily able to communicate to each other and hence user-info was able to send data to mosquitto.

Now going forward I do not want to create pods and would like to go with kind: Deployment but I wonder creating multiple pods is not possible in deployment. So if I create two deployment files for mosquitto-deployment.yaml & user-info-deployment.yaml, they both will create two different pods. So how can I make these pods communicate?

I read about service and we can communicate using service but I am having hard time with services. If I create a service for mosquitto, do I need to create service for user-info or it can directly communicate to mosquitto service. Also, is it not possible to use single deployment.yaml file for creating all the pods rather than using 2-3 deployment.yaml files.

Radek 'Goblin' Pieczonka

Having two distinct softwares in separate deployments make sense. You can have them both in single yaml file as long as you separate them with --- delimiter line, but that is essentialy the same as having separate file for each of them.

You need a service for a group of pods (0-N) to which something in your cluster (or outside for NodePort and LB svc) needs to connect to, so in your case you only need svc for Mosquitto, unless something else would also talk with user-info.

You can think about service as a loadbalancer sitting in front of selected group of pods.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

why do we use multiple pods in a kubernetes deployment

How many pods can be configured per deployment in kubernetes?

In Kubernetes how can I have a hard minimum number of pods for Deployment?

How to overwrite file in pods container in Kubernetes deployment file?

How to rolling restart pods without changing deployment yaml in kubernetes?

How Do I Delete Orphan Kubernetes Pods

kubernetes - How to ensure running pods are terminated before new pods are created for a deployment

Specifying memory in Kubernetes pods for deployment of Docker image

Kubectl command to list pods of a deployment in Kubernetes

kubernetes cleanup of pods,service,deployment etc

Why Kubernetes Services are created before Deployment/Pods?

How do you have a client deployment communicate with the api deployment in kubernetes

Hashicorp Consul - How to do verified TLS from Pods in Kubernetes cluster

How do I restrict connections to a service to a list of pods in Kubernetes?

How do I collect Java exceptions from Kubernetes pods?

How to make an environment variable different across two pods of the same deployment in kubernetes?

how to use Kubernetes DNS for pods?

How to access Kubernetes deployment

Usage of Kubectl command and deployment of pods using Kubernetes and Jenkins

What are production uses for Kubernetes pods without an associated deployment?

Kubernetes helm waiting before killing the old pods during helm deployment

Trying to create a Kubernetes deployment but it shows 0 pods available

How do I automate Kubernetes deployment YAML without relying on :latest?

How do I create a LoadBalancer service over Pods created by a ReplicaSet/Deployment

How to expose the scale of a deployment or statefulset to the pods in it?

How to adjust the output of kubectl get pods in kubernetes to watch pods status

how to assign affinity to kubernetes pods for distributing the pods across all ads?

How do you set up kubernetes RBAC resources so that pods can access the API via a client?

How do I get logs from all pods of a Kubernetes replication controller?