The below Yaml file is the configuration of a pod with one container:
A two containers pod:
Below is a Yaml configuration file of a pod with two containers ( nginx and debian ):
Running a command inside a container:
Because we have two containers inside the above pod, we would need to specify in which container we want to execute our commands.
We can do so using the "-c container_name" option, as we can see below:
From the "debian" container, we could run the below command to connect to the "nginx" container using the "localhost" network interface:
We could check the logs of "nginx" container, to see the details of the connection coming from the "debian" container, using the below command: