Pages

Sunday, May 13, 2018

kubernetes - Multi container Pod

                        
We already discussed that a pod is group of one or more containers working together. A Simple use case can be a pod having 2 containers , one as a web interface and the other one having a database running. There will be a communication between the 2 containers ( web interface and sql ). In this article we will see how we can create a pod with multiple containers,

Create a pod manifest file as
[root@manja17-I13330 kube-testing]# cat basic-pod.yml
apiVersion: v1
kind: Pod
metadata:
 name: testing-service
spec:
 containers:
   - name: test-ser
     image: docker.io/jagadesh1982/testing-service
     ports:
     - containerPort: 9876
   - name: shell
     image: centos:7
     command:
       - "bin/bash"
       - "-c"
       - "sleep 10000"

[root@manja17-I13330 ]# kubectl create -f basic-multi-container-pod.yml
pod "testing-service" created

[root@manja17-I13330 kube-testing]# kubectl get pods
NAME                    READY STATUS RESTARTS   AGE
sample-test-c9lcw   1/1 Running   0 23h
testing-service        2/2 Running 0               56s

We can see that the multi container pod testing-service is created and if you the
ready element , we have 2/2 which mean we have 2 containers running inside
that testing-service pod.

In the above configuration we can see we have created 2 containers with names ,
test-ser and shell. in the pod. We can now connect to these container using the
name of the container.

If you need to find out what containers are running inside a pod ,we can use
the “kubectl describe pod testing-service” which will give the details of the
containers running in that pod.

2 comments :

  1. The graphics in this game are pretty good overall.

    ReplyDelete
  2. My brother suggested I would possibly like this website.
    He was entirely right. This put up truly made my day.

    You cann't consider just how much time I had spent for this info!
    Thank you!

    ReplyDelete