Komlan Florient dogbe

Apr 2, 2021

5 min read

Multi container pod with Kubernetes: use case — Share volume,inter-process communication

Welcome to my new topic related to how to run multi container pod!!!!

Let’s discuss some of the key concept, for good understanding.

What’s pod ?

Pod is a small unit that contains a container used in kubernetes for creating and management.Pod is a group of one or more container with share capacity and network resources.

Typically you don’t need to create a pod with single container or multiple container. There are two way for run container inside pod.

- Pod that run a single container: most common in kubernetes use case

- Pod that run multi container : Pod can encapsulate multiple container that communicate together

This guide is base on multi container. let’s jump directly to practical part.

  • Share volume with kubernetes

Application of share volume with kubernetes using yaml file.

Run yaml file by using kubectl command

Running yaml file will create two container inside one pod. one container running nginx and other container running debian.

Check status of pods by kubectl get command

Print description of pod mc1

Output will be:

Notice, two container is running successfully with share volume mount in html repository.

Use kubectl exec command with -c <name_container> argument to connect with each container.

Describe in yaml file , index.html file is a share ressource connect to each container. Let’s connect to each container and verify .

  • Inter-process communication in one pod

Inter-process communication is a share communication message between two container.

In this example, we will set up one pod with two container. One container for producer and second for consumer.

Yaml file for Inter-process communication will be:

Run ipc.yml file for creating pod

Use kubectl describe command for description

output will be:

Check the logs for each container, means producer create a message queue and consumer receiver entire message

In this post, we have demonstrate share volume and Inter-process communication in multi container pod.

Hopefully you have enjoy this topic, follow me for my next write-up!!!!!!!!!