Communicating between Namespaces
Learn to establish communication between namespaces.
We'll cover the following...
Creating a Pod
We’ll create an alpine
-based Pod that we can use to demonstrate communication between namespaces.
Run the following commands in the widget:
Press + to interact
kubectl config use-context k3d-myclusterkubectl run test \--image=alpine \sleep 10000
We switch to the mycluster
context (default
namespace) and create a Pod with a container based on the alpine
image. We let it sleep
for a long time. Otherwise, the container would be without a process and stop almost immediately.
Before we proceed, we should confirm if the Pod is running:
Press + to interact
kubectl get pod test
The output is as follows:
Press + to interact
NAME READY STATUS RESTARTS AGEtest 1/1 Running 0 10m
Please wait a few moments if the Pod is not yet ready. ...