Chapter 21. Configuring for Red Hat Virtualization
You can configure OpenShift Container Platform for Red Hat Virtualization by creating a bastion virtual machine and using it to install OpenShift Container Platform.
21.1. Creating the bastion virtual machine Copy linkLink copied to clipboard!
Create a bastion virtual machine in Red Hat Virtualization to install OpenShift Container Platform.
Procedure
- Log in to the Manager machine by using SSH.
- Create a temporary bastion installation directory, for example, /bastion_installation, for the installation files.
Create an encrypted /bastion_installation/secure_vars.yaml file with
ansible-vault
and record the password:ansible-vault create secure_vars.yaml
# ansible-vault create secure_vars.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following parameter values to the secure_vars.yaml file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Password for logging in to the Administration Portal.
- 2
- Root password for the bastion virtual machine.
- 3
- Red Hat Subscription Manager credentials.
- 4
- Pool ID of the Red Hat Virtualization Manager subscription pool.
- 5
- OpenShift Container Platform root password.
- 6
- Red Hat Virtualization Manager CA certificate. The
engine_cafile
value is required if you are not running the playbook from the Manager machine. The Manager CA certificate’s default location is /etc/pki/ovirt-engine/ca.pem. - 7
- If you are using an image registry that requires authentication, add the credentials.
- Save the file.
Obtain the Red Hat Enterprise Linux KVM Guest Image download link:
- Navigate to Red Hat Customer Portal: Download Red Hat Enterprise Linux.
- In the Product Software tab, locate the Red Hat Enterprise Linux KVM Guest Image.
Right-click Download Now, copy the link, and save it.
The link is time-sensitive and must be copied just before you create the bastion virtual machine.
Create the /bastion_installation/create-bastion-machine-playbook.yaml file with the following content and update its parameter values:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- FQDN of the Manager machine.
- 2
<qcow_url>
is the download link of the Red Hat Enterprise Linux KVM Guest Image. The Red Hat Enterprise Linux KVM Guest Image includes thecloud-init
package, which is required by this playbook. If you are not using Red Hat Enterprise Linux, download thecloud-init
package and install it manually before running this playbook.
Create the bastion virtual machine:
ansible-playbook -i localhost create-bastion-machine-playbook.yaml -e @secure_vars.yaml --ask-vault-pass
# ansible-playbook -i localhost create-bastion-machine-playbook.yaml -e @secure_vars.yaml --ask-vault-pass
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Log in to the Administration Portal.
-
Click
to verify that the rhel-bastion virtual machine was created successfully.
21.2. Installing OpenShift Container Platform with the bastion virtual machine Copy linkLink copied to clipboard!
Install OpenShift Container Platform by using the bastion virtual machine in Red Hat Virtualization.
Procedure
- Log in to rhel-bastion.
Create an install_ocp.yaml file that contains the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a setup_dns.yaml file that contains the following content:
- hosts: masters strategy: free tasks: - shell: "echo {{ ansible_default_ipv4.address }} {{ inventory_hostname }} etcd.{{ inventory_hostname.split('.', 1)[1] }} openshift-master.{{ inventory_hostname.split('.', 1)[1] }} openshift-public-master.{{ inventory_hostname.split('.', 1)[1] }} docker-registry-default.apps.{{ inventory_hostname.split('.', 1)[1] }} webconsole.openshift-web-console.svc registry-console-default.apps.{{ inventory_hostname.split('.', 1)[1] }} >> /etc/hosts" when: openshift_ovirt_all_in_one is defined | ternary((openshift_ovirt_all_in_one | bool), false)
- hosts: masters strategy: free tasks: - shell: "echo {{ ansible_default_ipv4.address }} {{ inventory_hostname }} etcd.{{ inventory_hostname.split('.', 1)[1] }} openshift-master.{{ inventory_hostname.split('.', 1)[1] }} openshift-public-master.{{ inventory_hostname.split('.', 1)[1] }} docker-registry-default.apps.{{ inventory_hostname.split('.', 1)[1] }} webconsole.openshift-web-console.svc registry-console-default.apps.{{ inventory_hostname.split('.', 1)[1] }} >> /etc/hosts" when: openshift_ovirt_all_in_one is defined | ternary((openshift_ovirt_all_in_one | bool), false)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an /etc/ansible/openshift_3_11.hosts Ansible inventory file that contains the following content:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Obtain the Red Hat Enterprise Linux KVM Guest Image download link:
- Navigate to Red Hat Customer Portal: Download Red Hat Enterprise Linux.
- In the Product Software tab, locate the Red Hat Enterprise Linux KVM Guest Image.
Right-click Download Now, copy the link, and save it.
Do not use the link that you copied when you created the bastion virtual machine. The download link is time-sensitive and must be copied just before you run the installation playbook.
Create the vars.yaml file with the following content and update its parameter values:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- FQDN of the Manager machine.
- 2
<qcow_url>
is the download link of the Red Hat Enterprise Linux KVM Guest Image. The Red Hat Enterprise Linux KVM Guest Image includes thecloud-init
package, which is required by this playbook. If you are not using Red Hat Enterprise Linux, download thecloud-init
package and install it manually before running this playbook.
Install OpenShift Container Platform:
export ANSIBLE_ROLES_PATH="/usr/share/ansible/roles/:/usr/share/ansible/openshift-ansible/roles" export ANSIBLE_JINJA2_EXTENSIONS="jinja2.ext.do" ansible-playbook -i /etc/ansible/openshift_3_11.hosts install_ocp.yaml -e @vars.yaml -e @secure_vars.yaml --ask-vault-pass
# export ANSIBLE_ROLES_PATH="/usr/share/ansible/roles/:/usr/share/ansible/openshift-ansible/roles" # export ANSIBLE_JINJA2_EXTENSIONS="jinja2.ext.do" # ansible-playbook -i /etc/ansible/openshift_3_11.hosts install_ocp.yaml -e @vars.yaml -e @secure_vars.yaml --ask-vault-pass
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create DNS entries for the routers, for each infrastructure instance.
- Configure round-robin routing so that the router can pass traffic to the applications.
- Create a DNS entry for the OpenShift Container Platform web console.
- Specify the IP address of the load balancer node.