19.06.2021 Views

148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2 ■ Kubernetes on CoreOS on AWS

List the nodes:

kubectl get nodes

The single controller node and the three worker nodes are listed as shown in Figure 2-21.

Figure 2-21. Listing the Kubernetes cluster nodes

Testing the Cluster

To test the cluster, run some example application, such as the nginx server. Run three pod replicas of the

nginx application:

./kubectl -s http://localhost:8080 run nginx --image=nginx -replicas=3 --port=80

List the replication controllers:

./kubectl get rc

List the services:

./kubectl get services

List the deployments:

./kubectl get deployments

List the pods:

./kubectl get pods

Create a service for the nginx deployment:

./kubectl expose deployment nginx --port=80 --type=LoadBalancer

List the services again, and the nginx service should be listed:

./kubectl get services

Figure 2-22 shows the output from the preceding commands.

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!