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 OpenShiftRunning the Ansible PlaybookThe default inventory file is /etc/ansible/hosts but another file may be configured with the inventorysetting in the ansible.cfg, for example:inventory = /etc/ansible/inventory/hostsWe have configured the default inventory file /etc/ansible/hosts. Start the OpenShift cluster byrunning the Ansible playbook:ansible-playbook ~/openshift-ansible/playbooks/byo/config.ymlThe OpenShift software such as Docker, HAProxy, and so on are installed and started on the configuredhosts, as shown in Figure 15-11.Figure 15-11. Running the Ansible PlaybookSSH log in to one of the master instances and list the nodes in the OpenShift cluster:oc get nodesThe three nodes, two of them non-schedulable, are listed as shown in Figure 15-12.346

Chapter 15 ■ Using an HA Master with OpenShiftFigure 15-12. The nodes in the OpenShift clusterTesting the ClusterTo test the OpenShift cluster, log in to the cluster.oc loginSpecify Username as system and Password as admin. The OpenShift cluster is logged in. Initially noprojects are created, as shown in Figure 15-13.Figure 15-13. Logging into the OpenShift clusterCreate a new project, for example hello-openshift with the oc new-project command:oc new-project hello-openshiftThe hello-openshift project is created as shown in Figure 15-14.Figure 15-14. Creating the hello-openshift project347

Chapter 15 ■ Using an HA Master with OpenShift

Figure 15-12. The nodes in the OpenShift cluster

Testing the Cluster

To test the OpenShift cluster, log in to the cluster.

oc login

Specify Username as system and Password as admin. The OpenShift cluster is logged in. Initially no

projects are created, as shown in Figure 15-13.

Figure 15-13. Logging into the OpenShift cluster

Create a new project, for example hello-openshift with the oc new-project command:

oc new-project hello-openshift

The hello-openshift project is created as shown in Figure 15-14.

Figure 15-14. Creating the hello-openshift project

347

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

Saved successfully!

Ooh no, something went wrong!