How to deploy a multi-container pod in a Kubernetes cluster

Most of the time, when you deploy a pod to a Kubernetes cluster, it comprises only one container. But there are cases where you may want to deploy a pod with containers. Two very useful reasons for deploying multi-container pods would be:

Sidecar containers: an application container that helps or improves the operation of an application (examples of sidecar boxes are mail/observers of newspapers and watchdogs)

Proxies/bridges/adapters: connect the main container to the outside world

The main explanation for why you would implement a multi-container pod would be when an unmarried container could not cover all facets of the application. For example, imagine that you implement a pod for NGINX, but you want something to monitor the logs for that container. To do this, you can deploy a multi-pod container.

Create it or Fix the procedure is very difficult.

I’ll see the procedure for deploying a multi-container pod in a Kubernetes cluster. Specifically, we’ll create a pod with two containers, one running the NGINX Internet server that stores a volume with a container for now. The currently container will write the knowledge to the first to show how multiple container pods can interact.

SEE: DevOps Implementation: A Consultant for IT Professionals (Free PDF) (TechRepublic)

All this wants for paintings is a running Kubernetes cluster. If you have not yet introduced your cluster, see: How to Deploy a Kubernetes Cluster to an Ubuntu Server. Once your cluster is up and running, you’ll be able to deploy a multi-container pod.

As with everything in the Kubernetes field, we describe our multi-container pod in a YAML record. Then create the new record with the command:

In this file, paste the following content:

Take a look at the YAML file. You’ll see that we’ve deployed a container based on the NGINX image, as an Internet server. The currently container, called ubuntu-container, deploys a container, based on the Ubuntu image, and writes the text “Hello, Techrepublic” to the index.html file served through the first container.

Save and this file.

To deploy this multi-container pod, run the command:

Once the pod is deployed, give the boxes some time to go into the execution state (although only the first container continues to work), then the nginx-container shell with the command:

Now you’re in the bash spark of the nginx container. To make sure that our moment container has done its job, execute the order:

You will see the text “Hello, TechRepublic” published (Figure A).

Figure A

Our ubuntu container has effectively written the required text in the NGINX index.html file.

Hurrah!

And that’s how you can deploy a multi-container pod to your Kubernetes cluster. While this is a very fundamental example, it shows how boxes can interact in a group of single people.

Multicloud: a cheat sheet (TechRepublic)

Hybrid Cloud: A Consultant for IT Professionals (Download TechRepublic)

Serverless Computing: One for IT Administrators (TechRepublic Premium)

Important cloud in 2020: AWS, Microsoft Azure and Google Cloud, hybrids, SaaS players (ZDNet)

The best cloud services for small businesses (CNET)

Microsoft Office vs Google Docs Suite vs FreeOffice (Download.com)

Cloud Computing: More Policies to Read (TechRepublic on Flipboard)

Jack Wallen is an award for TechRepublic and Linux.com. He is an avid promoter of open source and voice of the Android expert. To learn more about Jack Wallen, visit his online page jackwallen.com.

Leave a Comment

Your email address will not be published. Required fields are marked *