Skip to Content
Kubernetes Cookbook - Second Edition
book

Kubernetes Cookbook - Second Edition

by Hideto Saito, Hui-Chuan Chloe Lee, Ke-Jou Carol Hsu
May 2018
Intermediate to advanced
554 pages
13h 51m
English
Packt Publishing
Content preview from Kubernetes Cookbook - Second Edition

How to do it...

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
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Cookbook

Kubernetes Cookbook

Sébastien Goasguen, Michael Hausenblas
DevOps with Kubernetes - Second Edition

DevOps with Kubernetes - Second Edition

Hideto Saito, Hui-Chuan Chloe Lee, Cheng-Yang Wu

Publisher Resources

ISBN: 9781788837606Supplemental Content