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

marco.cirilli
from marco.cirilli More from this publisher
19.06.2021 Views

Chapter 15 ■ Using an HA Master with OpenShiftFind the project status:oc statusCreate a new OpenShift application with the oc new-app command.oc new-app openshift/ruby-20-centos7~https://github.com/openshift/ruby-hello-world.gitA new OpenShift application is created.To delete all the objects for an application run the following command:oc delete all -l app=appNameFor example, to delete all the objects for the hello-world application, run the following command:oc delete all -l app=hello-worldCreate some other application with the oc new-app command. The image tag may be specified, forexample for the openshift/deployment-example Docker image.oc new-app openshift/deployment-example:v1An OpenShift application is created. Initially the oc get pods command may list the pods as notrunning, but with Status ContainerCreating as shown in Figure 15-15.Figure 15-15. Listing the podsMultiple applications from the same Docker image may be started concurrently; for example, run thesame command again:oc new-app openshift/deployment-example:v1When both the applications have started, two pods are listed, as shown in Figure 15-16.Figure 15-16. Running multiple applications concurrently348

Chapter 15 ■ Using an HA Master with OpenShiftThe node on which a pod is running may be listed with the following command:oc get –o wide podsThe node for the pod also is listed as shown in Figure 15-17.Figure 15-17. Listing pods including the nodesThe oc describe command is used to describe a deployment:oc describe dc/deployment-exampleThe services are listed with the following command:oc get servicesList all OpenShift objects with the following command:oc get allTesting the High AvailabilityWith multiple masters and High availability configured with the native method, the load balancer distributesthe master load across the masters. The master API server is exposed on the IP Address of the load balancer,but actually one API server is running on each of the masters. The two master instances and the singleworker instance are shown in Figure 15-18.349

Chapter 15 ■ Using an HA Master with OpenShift

Find the project status:

oc status

Create a new OpenShift application with the oc new-app command.

oc new-app openshift/ruby-20-centos7~https://github.com/openshift/ruby-hello-world.git

A new OpenShift application is created.

To delete all the objects for an application run the following command:

oc delete all -l app=appName

For example, to delete all the objects for the hello-world application, run the following command:

oc delete all -l app=hello-world

Create some other application with the oc new-app command. The image tag may be specified, for

example for the openshift/deployment-example Docker image.

oc new-app openshift/deployment-example:v1

An OpenShift application is created. Initially the oc get pods command may list the pods as not

running, but with Status ContainerCreating as shown in Figure 15-15.

Figure 15-15. Listing the pods

Multiple applications from the same Docker image may be started concurrently; for example, run the

same command again:

oc new-app openshift/deployment-example:v1

When both the applications have started, two pods are listed, as shown in Figure 15-16.

Figure 15-16. Running multiple applications concurrently

348

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

Saved successfully!

Ooh no, something went wrong!