May 2018
Intermediate to advanced
554 pages
13h 51m
English
In this recipe, we'll use localhost cluster as the main console to switch the cluster via context changes. First, run a different number of nginx into both the clusters and make sure the pods are all running:
// in the terminal of localhost cluster$ kubectl run local-nginx --image=nginx --replicas=2 --port=80deployment "local-nginx" created// check the running pods$ kubectl get podNAME READY STATUS RESTARTS AGElocal-nginx-6484bbb57d-xpjp2 1/1 Running 0 1mlocal-nginx-6484bbb57d-z4qgp 1/1 Running 0 1m// in the terminal of remote cluster$ kubectl run remote-nginx --image=nginx --replicas=4 --port=80deployment "remote-nginx" created$ kubectl get podNAME READY STATUS RESTARTS AGEremote-nginx-5dd7b9cb7d-fxr9m 1/1 Running 0 29s