We start by creating a deployment with two pod replicas as described in the "deployment_1.yaml" file below:
We create the deployment resource using the below command:
Displaying the created pods:
We can see that two replicas of "nginx" have been created by the deployment:
The containers inside the pod:
To get the ID of the container that lives inside a pod, we could use the below command:
If we have multiple container inside a pod, we use the below to connect to a specific container using its ID and execute a command inside:
Excecuting a command inside a pod:
Because we only have one container in the pod, we don't need to use the "-c" option:
In our examples, we have:
The above command runs the "ls -a" command inside the pod with the following ID "nginxdeployment-5b9fb7b7d9-2vhsk".
Comments