Chapter 3. Deploying Red Hat OpenShift Container Platform

With the prerequisites met, the focus shifts to the installation Red Hat OpenShift Container Platform. The installation and configuration is done via a series of Ansible playbooks and roles provided by the atomic-openshift packages.

Run the installer playbook to install Red Hat OpenShift Container Platform:

# ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml

The playbooks runs through the complete process of installing Red Hat OpenShift Container Platform and reports a playbook recap showing the number of changes and errors (if any).

PLAY RECAP ********************************************************************************************************************************************************************************************************
ocp-app-1 : ok=233  changed=40   unreachable=0    failed=0
ocp-app-2 : ok=233  changed=40   unreachable=0    failed=0
ocp-app-3 : ok=233  changed=40   unreachable=0    failed=0
ocp-infra-1 : ok=233  changed=40   unreachable=0    failed=0
ocp-infra-2 : ok=233  changed=40   unreachable=0    failed=0
ocp-infra-3 : ok=233  changed=40   unreachable=0    failed=0
localhost   : ok=12   changed=0    unreachable=0    failed=0
ocp-master-1 : ok=674  changed=161  unreachable=0    failed=0
ocp-master-2 : ok=442  changed=103  unreachable=0    failed=0
ocp-master-3 : ok=442  changed=103  unreachable=0    failed=0

3.1. Storage class deployment

A Red Hat OpenShift Container Platform storageclass object is required for persistent storage for applications and logging if CNS is not deployed. A Red Hat OpenShift Container Platform deployment can have many storageclass objects but only one can be the default.

Create the yaml file defining the Microsoft Azure storage to be used.

# vi storageclass.yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: standard
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: kubernetes.io/azure-disk
parameters:
  storageaccounttype: Standard_LRS
  kind: managed

Log into one of the master instances and use the oc client to create the default storageclass object.

# oc create -f storageclass.yaml

3.2. Logging

Return to the host that performed the deployment of OpenShift. Now that a persistent storage exists Red Hat OpenShift Container Platform logging can be deployed to store application container logs.

# vi /etc/ansible/hosts
...omitted...
openshift_logging_install_logging=true
openshift_logging_es_pvc_size=100Gi
openshift_logging_es_pvc_dynamic=True
openshift_logging_es_cluster_size=3
openshift_logging_es_nodeselector={"region": "infra"}
openshift_logging_kibana_nodeselector={"region": "infra"}
openshift_logging_curator_nodeselector={"region": "infra"}

Run the Ansible playbook below to deploy the logging components.

# ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-logging/config.yml

3.3. Metrics

Red Hat OpenShift Container Platform metrics requires persistent storage. Modify the inventory to add in the variables for the installation of OpenShift metrics.

# vi /etc/ansible/hosts
...omitted...
openshift_metrics_install_metrics=true
openshift_metrics_cassandra_pvc_size=20Gi
openshift_metrics_cassandra_storage_type=dynamic
openshift_metrics_cassandra_replicas="1"
openshift_metrics_hawkular_nodeselector={"region":"infra"}
openshift_metrics_cassandra_nodeselector={"region":"infra"}
openshift_metrics_heapster_nodeselector={"region":"infra"}

Run the Ansible playbook below to deploy the metrics components.

# ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml

3.4. Service Catalog

The service catalog also requires persistent storage to be used for an etcd pod that runs within the Red Hat OpenShift Container Platform project. Modify the inventory to change the value of openshift_enable_service_catalog from false to true.

# vi /etc/ansible/hosts
...omitted...
#openshift_enable_service_catalog=false
openshift_enable_service_catalog=true

Run the Ansible playbook below to deploy the service catalog components.

# ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-service-catalog/config.yml

3.5. Cloudforms Integration (Optional)

The steps defined below assume that Red Hat Cloudforms has been deployed and is accessible by the OpenShift environment.

Note

To receive the most information about the deployed environment ensure that the OpenShift metrics components are deployed.

3.5.1. Requesting the Red Hat OpenShift Container Platform Management Token

The management token is used to allow for Cloudforms to retrieve information from the recently deployed OpenShift environment.

To request this token run the following command from a system with the oc client installed and from an account that has privileges to request the token from the management-infra namespace.

oc sa get-token -n management-infra management-admin
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJtYW5hZ2VtZW50LWluZnJhIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im1hbmFnZW1lbnQtYWRtaW4tdG9rZW4tdHM0cTIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoibWFuYWdlbWVudC1hZG1pbiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImY0ZDlmMGMxLTEyY2YtMTFlOC1iNTgzLWZhMTYzZTEwNjNlYSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDptYW5hZ2VtZW50LWluZnJhOm1hbmFnZW1lbnQtYWRtaW4ifQ.LwNm0652paGcJu7m63PxBhs4mjXwYcqMS5KD-0aWkEMCPo64WwNEawyyYH31SvuEPaE6qFxZwDdJHwdNsfq1CjUL4BtZHv1I2QZxpVl6gMBQowNf6fWSeGe1FDZ4lkLjzAoMOCFUWA0Z7lZM1FAlyjfz2LkPNKaFW0ffelSJ2SteuXB_4FNup-T5bKEPQf2pyrwvs2DadClyEEKpIrdZxuekJ9ZfIubcSc3pp1dZRu8wgmSQSLJ1N75raaUU5obu9cHjcbB9jpDhTW347oJOoL_Bj4bf0yyuxjuUCp3f4fs1qhyjHb5N5LKKBPgIKzoQJrS7j9Sqzo9TDMF9YQ5JLQ

3.5.2. Adding OpenShift as a Containtainer Provider

Now that the token has been acquired, perform the following steps in the link below to add Red Hat OpenShift Container Platform to Red Hat Cloudforms.

https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.6/html/integration_with_openshift_container_platform/integration

3.5.3. Adding Microsoft Azure to Cloudforms

Red Hat Cloudforms also allows for not only the management of Red Hat OpenShift Container Platform but also for the management of Microsoft Azure. The link below contains the steps for adding Microsoft Azure to Cloudforms.

https://access.redhat.com/documentation/en-us/red_hat_cloudforms/4.6/html/managing_providers/cloud_providers#azure_providers