How many microservices per kubernetes pod?

How many microservices should I have per Kubernetes Pod? This is the question I had when I first encountered Kubernetes when trying to decide how to deploy my Microservice architecture based application.

When reading through Kubernetes documentation or watching videos about kubernetes, you are told a pod holds one or more containers. So your first question if you are doing microservices probably is. How many microservices do I put per pod if each microservice goes into a container? I mean it sort of seems like you could put all of your microservices in containers then put those in a pod.  You could do this, but it is not the correct way.

I kept digging and digging until I found a definitive answer. This video helped. It does a great job of explaining what a Pod is in Kubernetes and how it relates to microservices.

So as you can see each microservice goes into a container and each container becomes a pod. Therefore the answer is you should place one microservice per pod. However, as noted if your microservice container relies on something else then you also place that inside the pod, but do not place more than one microservice in a pod. If you are wondering more about when you would use more than one container in a pod this article gives examples.

Another question you may have is how many pods can you have per node? That is totally up to who you are using as your host, if you are using cloud services then many will list the limit. Here is a link I found about Amazon cloud instance limits.

Links

Here is a link to the documentation shown in the video about PODS.

Here is a link the the Kubernetes API documentation shown in the video.

Here is a link to more Kubernetes resources.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: