I am trying to create a container with two containers, each of which has different images! Not sure how to expose two different containers to the client. Below is my yaml file for deployment.
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: checkdifimage spec: replicas: 1 template: metadata: labels: app: checkdifimagelab spec: containers: - name: checkallcont1 image: <dockerimage> ports: - containerPort: 32030 - name: checkall1cont2 image: <dockerimage2> ports: - containerPort: 32031
What I'm doing now is after my deployment has unfolded. To call the service, run the following command:
kubectl expose pod checkdifimage --port=8080 --type=NodePort --name=diffimage
This works for a single container and can be detrimental to service from a rest customer. But when I use 2 containers, I can hit only one container. How do I switch to both containers? In addition, if someone can, please, trace the advantages and disadvantages of using one unit having one image against one container having several images!
source share