Red Hat Enterprise Linux-8-Deploying Red Hat Enterprise Linux 8 On Public Cloud Platforms-En-us
Red Hat Enterprise Linux-8-Deploying Red Hat Enterprise Linux 8 On Public Cloud Platforms-En-us
Red Hat Enterprise Linux-8-Deploying Red Hat Enterprise Linux 8 On Public Cloud Platforms-En-us
Creating Red Hat Enterprise Linux system images and configuring a Red Hat High
Availability cluster for public cloud platforms
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift,
Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States
and other countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the
official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other
countries and are used with the OpenStack Foundation's permission. We are not affiliated with,
endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
You can create and deploy custom Red Hat Enterprise Linux images to various cloud platforms,
including Microsoft Azure, Amazon Web Services (AWS), and Google Cloud Platform (GCP). You
can also create and configure a Red Hat High Availability cluster on each cloud platform. This
document provides instructions for creating system images, and also for setting up high-availability
(HA) clusters. including installing required packages and agents, configuring fencing, and installing
network resource agents.
Table of Contents
Table of Contents
. . . . . . . . . .OPEN
MAKING . . . . . . SOURCE
. . . . . . . . . .MORE
. . . . . . .INCLUSIVE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5. . . . . . . . . . . . .
. . . . . . . . . . . . . FEEDBACK
PROVIDING . . . . . . . . . . . . ON
. . . .RED
. . . . .HAT
. . . . .DOCUMENTATION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6. . . . . . . . . . . . .
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7. . . . . . . . . . . . .
AZURE
1.1. RED HAT ENTERPRISE LINUX IMAGE OPTIONS ON AZURE 7
1.2. UNDERSTANDING BASE IMAGES 9
1.2.1. Using a custom base image 9
1.2.2. Required system packages 9
1.2.3. Azure VM configuration settings 10
1.2.4. Creating a base image from an ISO image 10
1.3. CONFIGURING A CUSTOM BASE IMAGE FOR MICROSOFT AZURE 11
1.3.1. Installing Hyper-V device drivers 12
1.3.2. Making configuration changes required for a Microsoft Azure deployment 13
1.4. CONVERTING THE IMAGE TO A FIXED VHD FORMAT 15
1.5. INSTALLING THE AZURE CLI 16
1.6. CREATING RESOURCES IN AZURE 17
1.7. UPLOADING AND CREATING AN AZURE IMAGE 20
1.8. CREATING AND STARTING THE VM IN AZURE 21
1.9. OTHER AUTHENTICATION METHODS 23
1.10. ATTACHING RED HAT SUBSCRIPTIONS 23
1.11. SETTING UP AUTOMATIC REGISTRATION ON AZURE GOLD IMAGES 24
1.12. ADDITIONAL RESOURCES 25
. . . . . . . . . . . 2.
CHAPTER . . CONFIGURING
. . . . . . . . . . . . . . . .A
. . RED
. . . . . HAT
. . . . . HIGH
. . . . . .AVAILABILITY
. . . . . . . . . . . . . . . CLUSTER
. . . . . . . . . . .ON
. . . MICROSOFT
. . . . . . . . . . . . . .AZURE
. . . . . . . . . . . . . . . . . .26
..............
2.1. CREATING RESOURCES IN AZURE 26
2.2. REQUIRED SYSTEM PACKAGES FOR HIGH AVAILABILITY 30
2.3. AZURE VM CONFIGURATION SETTINGS 31
2.4. INSTALLING HYPER-V DEVICE DRIVERS 31
2.5. MAKING CONFIGURATION CHANGES REQUIRED FOR A MICROSOFT AZURE DEPLOYMENT 32
2.6. CREATING AN AZURE ACTIVE DIRECTORY APPLICATION 35
2.7. CONVERTING THE IMAGE TO A FIXED VHD FORMAT 36
2.8. UPLOADING AND CREATING AN AZURE IMAGE 37
2.9. INSTALLING RED HAT HA PACKAGES AND AGENTS 38
2.10. CREATING A CLUSTER 40
2.11. FENCING OVERVIEW 41
2.12. CREATING A FENCING DEVICE 41
2.13. CREATING AN AZURE INTERNAL LOAD BALANCER 43
2.14. CONFIGURING THE LOAD BALANCER RESOURCE AGENT 44
2.15. CONFIGURING SHARED BLOCK STORAGE 45
2.16. ADDITIONAL RESOURCES 50
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
SERVICES ..............
3.1. RED HAT ENTERPRISE LINUX IMAGE OPTIONS ON AWS 51
3.2. UNDERSTANDING BASE IMAGES 53
3.2.1. Using a custom base image 53
3.2.2. Virtual machine configuration settings 53
3.3. CREATING A BASE VM FROM AN ISO IMAGE 53
3.3.1. Creating a VM from the RHEL ISO image 54
3.3.2. Completing the RHEL installation 54
1
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
.CHAPTER
. . . . . . . . . . 4.
. . .CONFIGURING
. . . . . . . . . . . . . . . .A. RED
. . . . . HAT
. . . . . HIGH
. . . . . . AVAILABILITY
. . . . . . . . . . . . . . . CLUSTER
. . . . . . . . . . .ON
. . . .AWS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
..............
4.1. CREATING THE AWS ACCESS KEY AND AWS SECRET ACCESS KEY 65
4.2. INSTALLING THE AWS CLI 66
4.3. CREATING AN HA EC2 INSTANCE 66
4.4. CONFIGURING THE PRIVATE KEY 68
4.5. CONNECTING TO AN EC2 INSTANCE 68
4.6. INSTALLING THE HIGH AVAILABILITY PACKAGES AND AGENTS 68
4.7. CREATING A CLUSTER 70
4.8. CONFIGURING FENCING 71
4.9. INSTALLING THE AWS CLI ON CLUSTER NODES 74
4.10. INSTALLING NETWORK RESOURCE AGENTS 74
4.11. CONFIGURING SHARED BLOCK STORAGE 77
4.12. ADDITIONAL RESOURCES 79
CHAPTER 5. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A GOOGLE COMPUTE ENGINE
. . . . . . . . . . . .ON
INSTANCE . . . .GOOGLE
. . . . . . . . . .CLOUD
. . . . . . . .PLATFORM
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
..............
5.1. RED HAT ENTERPRISE LINUX IMAGE OPTIONS ON GCP 80
5.2. UNDERSTANDING BASE IMAGES 82
5.2.1. Using a custom base image 82
5.2.2. Virtual machine configuration settings 82
5.3. CREATING A BASE VM FROM AN ISO IMAGE 82
5.3.1. Creating a VM from the RHEL ISO image 82
5.3.2. Completing the RHEL installation 83
5.4. UPLOADING THE RHEL IMAGE TO GCP 84
5.4.1. Creating a new project on GCP 84
5.4.2. Installing the Google Cloud SDK 85
5.4.3. Creating SSH keys for Google Compute Engine 85
5.4.4. Creating a storage bucket in GCP Storage 86
5.4.5. Converting and uploading your image to your GCP Bucket 86
5.4.6. Creating an image from the object in the GCP bucket 87
5.4.7. Creating a Google Compute Engine instance from an image 88
5.4.8. Connecting to your instance 89
5.4.9. Attaching Red Hat subscriptions 89
5.5. ADDITIONAL RESOURCES 90
. . . . . . . . . . . 6.
CHAPTER . . .CONFIGURING
. . . . . . . . . . . . . . . RED
. . . . . HAT
. . . . . HIGH
. . . . . . AVAILABILITY
. . . . . . . . . . . . . . . CLUSTER
. . . . . . . . . . .ON
. . . .GOOGLE
. . . . . . . . . .CLOUD
. . . . . . . .PLATFORM
. . . . . . . . . . . . . . . 91
..............
6.1. REQUIRED SYSTEM PACKAGES 91
6.2. RED HAT ENTERPRISE LINUX IMAGE OPTIONS ON GCP 92
6.3. INSTALLING THE GOOGLE CLOUD SDK 93
6.4. CREATING A GCP IMAGE BUCKET 94
6.5. CREATING A CUSTOM VIRTUAL PRIVATE CLOUD NETWORK AND SUBNET 94
6.6. PREPARING AND IMPORTING A BASE GCP IMAGE 95
2
Table of Contents
3
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
4
MAKING OPEN SOURCE MORE INCLUSIVE
5
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
1. View the documentation in the Multi-page HTML format and ensure that you see the
Feedback button in the upper right corner after the page fully loads.
2. Use your cursor to highlight the part of the text that you want to comment on.
3. Click the Add Feedback button that appears near the highlighted text.
4. Enter your suggestion for improvement in the Description field. Include links to the relevant
parts of the documentation.
6
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
Lists or refers to system requirements for your host system and virtual machine (VM)
Provides procedures for creating a custom VM from an ISO image, uploading it to Azure, and
launching an Azure VM instance
IMPORTANT
You can create a custom VM from an ISO image, but Red Hat recommends that you use
the Red Hat Image Builder product to create customized images for use on specific cloud
providers. With Image Builder, you can create and upload an Azure Disk Image (VHD
format). See Composing a Customized RHEL System Image for more information.
For a list of Red Hat products that you can use securely on Azure, refer to Red Hat on Microsoft Azure.
Prerequisites
Enable your subscriptions in the Red Hat Cloud Access program. The Red Hat Cloud Access
program allows you to move your Red Hat subscriptions from physical or on-premise systems to
Azure with full support from Red Hat.
7
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Choose to deploy a Red Use your existing Red Enable subscriptions The subscription
Hat Gold Image. Hat subscriptions. through the Red Hat includes the Red Hat
Cloud Access program, product cost; you pay
and then choose a Red Microsoft for all other
Hat Gold Image on instance costs.
Azure. See the Red Hat
Cloud Access Reference Red Hat Gold Images
Guide for details on are called "Cloud
Gold Images and how to Access" images because
access them on Azure. you use your existing
Red Hat subscriptions.
Red Hat provides
support directly for
Cloud Access images.
Choose to deploy a Use your existing Red Enable subscriptions The subscription
custom image that you Hat subscriptions. through the Red Hat includes the Red Hat
move to Azure. Cloud Access program, product cost; you pay
upload your custom Microsoft for all other
image, and attach your instance costs.
subscriptions.
Custom images that you
move to Azure are
"Cloud Access" images
because you use your
existing Red Hat
subscriptions. Red Hat
provides support directly
for Cloud Access
images.
Choose to deploy an The Azure images Choose a RHEL image You pay Microsoft
existing Azure image include a Red Hat when you create a VM hourly on a pay-as-you-
that includes RHEL. product. using the Azure console, go model. Such images
or choose a VM from are called "on-demand."
the Azure Marketplace. Azure provides support
for on-demand images
through a support
agreement.
NOTE
8
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
NOTE
You can create a custom image for Azure using Red Hat Image Builder. See Composing a
Customized RHEL System Image for more information.
The following sections provide information and procedures related to Red Hat Enterprise Linux custom
images.
Additional resources
Azure Marketplace
To prepare a cloud image of RHEL, follow the instructions in the sections below. To prepare a Hyper-V
cloud image of RHEL, see the Prepare a Red Hat-based virtual machine from Hyper-V Manager .
9
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Setting Recommendation
Prerequisites
Ensure that you have enabled your host machine for virtualization. See Enabling virtualization in
RHEL 8 for information and procedures.
Procedure
1. Download the latest Red Hat Enterprise Linux 8 DVD ISO image from the Red Hat Customer
Portal.
2. Create and start a basic Red Hat Enterprise Linux VM. For instructions, see Creating virtual
10
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
2. Create and start a basic Red Hat Enterprise Linux VM. For instructions, see Creating virtual
machines.
a. If you use the command line to create your VM, ensure that you set the default memory and
CPUs to the capacity you want for the VM. Set your virtual network interface to virtio.
For example, the following command creates a kvmtest VM using the rhel-8.0-x86_64-
kvm.qcow2 image:
# virt-install \
--name kvmtest --memory 2048 --vcpus 2 \
--disk rhel-8.0-x86_64-kvm.qcow2,bus=virtio \
--import --os-variant=rhel8.0
b. If you use the web console to create your VM, follow the procedure in Creating virtual
machines using the web console, with these caveats:
Before you start the installation, ensure that you have changed Model under Virtual
Network Interface Settings to virtio and change your vCPUs to the capacity settings
you want for the VM.
For Installation Destination, select Custom Storage Configuration. Use the following
configuration information to make your selections.
For file system, use xfs, ext4, or ext3 for both boot and root partitions.
Remove swap space. Swap space is configured on the physical blade server in Azure by
the WALinuxAgent.
On the Installation Summary screen, select Network and Host Name. Switch Ethernet to
On.
5. When installation is complete, reboot the VM and log in to the root account.
6. Once you are logged in as root, you can configure the image.
11
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Procedure
1. Enter the following grep command to determine if the required Hyper-V device drivers are
installed.
# lsinitrd | grep hv
# lsinitrd | grep hv
drwxr-xr-x 2 root root 0 Aug 12 14:21 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/hv
-rw-r--r-- 1 root root 31272 Aug 11 08:45 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/hv/hv_vmbus.ko.xz
-rw-r--r-- 1 root root 25132 Aug 11 08:46 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/net/hyperv/hv_netvsc.ko.xz
-rw-r--r-- 1 root root 9796 Aug 11 08:45 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/scsi/hv_storvsc.ko.xz
If all the drivers are not installed, complete the remaining steps.
NOTE
An hv_vmbus driver may exist in the environment. Even if this driver is present,
complete the following steps.
NOTE
Note the spaces before and after the quotes, for example, add_drivers+="
hv_vmbus ". This ensures that unique drivers are loaded in the event that other
Hyper-V drivers already exist in the environment.
# dracut -f -v --regenerate-all
12
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
Verification
2. Run the lsinitrd | grep hv command to verify that the drivers are installed.
Procedure
2. Register the VM, and enable the Red Hat Enterprise Linux 8 repository.
4. Create cloud-init configuration files that are needed for integration with Azure services:
a. To enable logging to the Hyper-V Data Exchange Service (KVP), create the
/etc/cloud/cloud.cfg.d/10-azure-kvp.cfg configuration file and add the following lines to
that file.
reporting:
logging:
type: log
telemetry:
type: hyperv
datasource_list: [ Azure ]
datasource:
Azure:
apply_network_config: False
5. To ensure that specific kernel modules are blocked from loading automatically, edit or create
the /etc/modprobe.d/blocklist.conf file and add the following lines to that file.
blacklist nouveau
blacklist lbm-nouveau
blacklist floppy
13
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
blacklist amdgpu
blacklist skx_edac
blacklist intel_cstate
# rm -f /etc/udev/rules.d/70-persistent-net.rules
# rm -f /etc/udev/rules.d/75-persistent-net-generator.rules
# rm -f /etc/udev/rules.d/80-net-name-slot-rules
b. To ensure that Accelerated Networking on Azure works as intended, create a new network
device rule /etc/udev/rules.d/68-azure-sriov-nm-unmanaged.rules and add the following
line to it.
a. Open the /etc/default/grub file, and ensure the GRUB_TIMEOUT line has the following
value.
GRUB_TIMEOUT=10
b. Remove the following options from the end of the GRUB_CMDLINE_LINUX line if present.
rhgb quiet
c. Ensure the /etc/default/grub file contains the following lines with all the specified options.
# grub2-mkconfig -o /boot/grub2/grub.cfg
On a UEFI-based machine:
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
14
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
If your system uses a non-default location for grub.cfg, adjust the command accordingly.
b. To ensure that a swap partition is not used in provisioned VMs, edit the following lines in the
/etc/waagent.conf file.
Provisioning.DeleteRootPassword=y
ResourceDisk.Format=n
ResourceDisk.EnableSwap=n
# subscription-manager unregister
NOTE
# export HISTSIZE=0
# poweroff
Procedure
#!/bin/bash
15
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
MB=$((1024 * 1024))
size=$(qemu-img info -f raw --output json "$1" | gawk 'match($0, /"virtual-size": ([0-9]+),/, val)
{print val[1]}')
rounded_size=$((($size/$MB + 1) * $MB))
if [ $(($size % $MB)) -eq 0 ]
then
echo "Your image is already aligned. You do not need to resize."
exit 1
fi
echo "rounded size = $rounded_size"
export rounded_size
$ sh align.sh <image-xxx>.raw
If the message "Your image is already aligned. You do not need to resize." displays, proceed
to the following step.
4. Use the following command to convert the file to a fixed VHD format.
The sample uses qemu-img version 2.12.0.
5. If the raw image is not aligned, complete the following steps to align it.
a. Resize the raw file using the rounded value displayed when you ran the verification script.
Prerequisites
You need to have an account with Microsoft Azure before you can use the Azure CLI.
16
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
Procedure
$ yum check-update
4. Check your Python version (python --version) and install Python 3.x, if necessary.
$ az
Additional resources
Azure CLI
Procedure
$ az login
NOTE
If a browser is available in your environment, the CLI opens your browser to the
Azure sign-in page. See Sign in with Azure CLI for more information and options.
17
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Example:
3. Create a storage account. See SKU Types for more information about valid SKU values.
Example:
18
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
"statusOfSecondary": null,
"tags": {},
"type": "Microsoft.Storage/storageAccounts"
}
Example:
5. Export the connection string by copying the connection string and pasting it into the following
command. This string connects your system to the storage account.
$ export AZURE_STORAGE_CONNECTION_STRING="<storage-connection-string>"
Example:
[clouduser@localhost]$ export
AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;Endpoi
ntSuffix=core.windows.net;AccountName=azrhelclistact;AccountKey=NreGk...=="
Example:
Example:
19
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"dhcpOptions": {
"dnsServers": []
},
"etag": "W/\"\"",
"id":
"/subscriptions//resourceGroups/azrhelclirsgrp/providers/Microsoft.Network/virtualNetworks/azr
helclivnet1",
"location": "southcentralus",
"name": "azrhelclivnet1",
"provisioningState": "Succeeded",
"resourceGroup": "azrhelclirsgrp",
"resourceGuid": "0f25efee-e2a6-4abe-a4e9-817061ee1e79",
"subnets": [
{
"addressPrefix": "10.0.0.0/24",
"etag": "W/\"\"",
"id":
"/subscriptions//resourceGroups/azrhelclirsgrp/providers/Microsoft.Network/virtualNetworks/azr
helclivnet1/subnets/azrhelclisubnet1",
"ipConfigurations": null,
"name": "azrhelclisubnet1",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "azrhelclirsgrp",
"resourceNavigationLinks": null,
"routeTable": null
}
],
"tags": {},
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": null
}
}
Additional resources
SKU Types
NOTE
The exported storage connection string does not persist after a system reboot. If any of
the commands in the following steps fail, export the connection string again.
20
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
Procedure
1. Upload the VHD file to the storage container. It may take several minutes. To get a list of
storage containers, enter the az storage container list command.
Example:
2. Get the URL for the uploaded VHD file to use in the following step.
Example:
NOTE
The default hypervisor generation of the VM is V1. You can optionally specify a
V2 hypervisor generation by including the option --hyper-v-generation V2.
Generation 2 VMs use a UEFI-based boot architecture. See Support for
generation 2 VMs on Azure for information on generation 2 VMs.
The command may return the error "Only blobs formatted as VHDs can be
imported." This error may mean that the image was not aligned to the nearest 1
MB boundary before it was converted to VHD.
Example:
21
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Procedure
$ az vm create \
-g <resource-group> -l <azure-region> -n <vm-name> \
--vnet-name <vnet-name> --subnet <subnet-name> --size Standard_A2 \
--os-disk-name <simple-name> --admin-username <administrator-name> \
--generate-ssh-keys --image <path-to-image>
NOTE
Example:
[clouduser@localhost]$ az vm create \
-g azrhelclirsgrp2 -l southcentralus -n rhel-azure-vm-1 \
--vnet-name azrhelclivnet1 --subnet azrhelclisubnet1 --size Standard_A2 \
--os-disk-name vm-1-osdisk --admin-username clouduser \
--generate-ssh-keys --image rhel8
{
"fqdns": "",
"id":
"/subscriptions//resourceGroups/azrhelclirsgrp/providers/Microsoft.Compute/virtualMachines/rhe
l-azure-vm-1",
"location": "southcentralus",
"macAddress": "",
"powerState": "VM running",
"privateIpAddress": "10.0.0.4",
"publicIpAddress": "<public-IP-address>",
"resourceGroup": "azrhelclirsgrp2"
Note the publicIpAddress. You need this address to log in to the VM in the following step.
[clouduser@rhel-azure-vm-1 ~]$
If you see a user prompt, you have successfully deployed your Azure VM.
You can now go to the Microsoft Azure portal and check the audit logs and properties of your resources.
You can manage your VMs directly in this portal. If you are managing multiple VMs, you should use the
Azure CLI. The Azure CLI provides a powerful interface to your resources in Azure. Enter az --help in
22
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
the CLI or see the Azure CLI command reference to learn more about the commands you use to
manage your VMs in Microsoft Azure.
Example 1: These command options provision a new VM without generating a public key file. They allow
SSH authentication using a password.
$ az vm create \
-g <resource-group> -l <azure-region> -n <vm-name> \
--vnet-name <vnet-name> --subnet <subnet-name> --size Standard_A2 \
--os-disk-name <simple-name> --authentication-type password \
--admin-username <administrator-name> --admin-password <ssh-password> --image <path-
to-image>
$ ssh <admin-username>@<public-ip-address>
Example 2: These command options provision a new Azure VM and allow SSH authentication using an
existing public key file.
$ az vm create \
-g <resource-group> -l <azure-region> -n <vm-name> \
--vnet-name <vnet-name> --subnet <subnet-name> --size Standard_A2 \
--os-disk-name <simple-name> --admin-username <administrator-name> \
--ssh-key-value <path-to-existing-ssh-key> --image <path-to-image>
Prerequisites
Procedure
You can use an activation key to attach subscriptions. See Creating Red Hat Customer
Portal Activation Keys for more information.
Alternatively, you can manually attach a subscription using the ID of the subscription pool
23
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Alternatively, you can manually attach a subscription using the ID of the subscription pool
(Pool ID). See Attaching and Removing Subscriptions Through the Command Line .
Additional resources
Prerequisites
You have enabled an eligible Red Hat product subscription for Cloud Access on Azure, and
RHEL 8 Gold Images are therefore available to you in Microsoft Azure. For instructions, see
Using Gold Images on Azure.
NOTE
A Microsoft Azure account can only be attached to a single Red Hat account at a
time. Therefore, ensure no other users require access to the Azure account
before attaching it to your Red Hat one.
Procedure
1. Use the Gold Image to create a RHEL 8 VM in your Azure instance. For instructions, see
Creating and starting the VM in Azure .
6. Power off the VM, and save it as a managed image on Azure. For instructions, see How to create
a managed image of a virtual machine or VHD.
7. Create VMs using the managed image. They will be automatically subscribed to RHSM.
24
CHAPTER 1. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS A VIRTUAL MACHINE ON MICROSOFT AZURE
Verification
In a RHEL 8 VM created using the above instructions, verify the system is registered to RHSM
by executing the subscription-manager identity command. On a successfully registered
system, this displays the UUID of the system. For example:
# subscription-manager identity
system identity: fdc46662-c536-43fb-a18a-bbcb283102b7
name: 192.168.122.222
org name: 6340056
org ID: 6340056
Additional resources
25
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Prerequisite procedures for setting up your environment for Azure. After you set up your
environment, you can create and configure Azure VM instances.
Procedures specific to the creation of HA clusters, which transform individual nodes into a
cluster of HA nodes on Azure. These include procedures for installing the High Availability
packages and agents on each cluster node, configuring fencing, and installing Azure network
resource agents.
Prerequisites
You need to install Azure command line interface (CLI). For more information, see Installing the
Azure CLI.
Enable your subscriptions in the Red Hat Cloud Access program . The Red Hat Cloud Access
program allows you to move your Red Hat subscriptions from physical or on-premise systems
onto Azure with full support from Red Hat.
Procedure
$ az login
NOTE
If a browser is available in your environment, the CLI opens your browser to the
Azure sign-in page.
Example:
[clouduser@localhost]$ az login
26
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code
FDMSCMETZ to authenticate.
[
{
"cloudName": "AzureCloud",
"id": "Subscription ID",
"isDefault": true,
"name": "MySubscriptionName",
"state": "Enabled",
"tenantId": "Tenant ID",
"user": {
"name": "[email protected]",
"type": "user"
}
}
]
Example:
{
"id": "/subscriptions//resourceGroups/azrhelclirsgrp",
"location": "southcentralus",
"managedBy": null,
"name": "azrhelclirsgrp",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null
}
Example:
{
"accessTier": null,
"creationTime": "2017-04-05T19:10:29.855470+00:00",
"customDomain": null,
"encryption": null,
"id":
"/subscriptions//resourceGroups/azrhelclirsgrp/providers/Microsoft.Storage/storageAccounts/azr
27
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
helclistact",
"kind": "StorageV2",
"lastGeoFailoverTime": null,
"location": "southcentralus",
"name": "azrhelclistact",
"primaryEndpoints": {
"blob": "https://azrhelclistact.blob.core.windows.net/",
"file": "https://azrhelclistact.file.core.windows.net/",
"queue": "https://azrhelclistact.queue.core.windows.net/",
"table": "https://azrhelclistact.table.core.windows.net/"
},
"primaryLocation": "southcentralus",
"provisioningState": "Succeeded",
"resourceGroup": "azrhelclirsgrp",
"secondaryEndpoints": null,
"secondaryLocation": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"statusOfPrimary": "available",
"statusOfSecondary": null,
"tags": {},
"type": "Microsoft.Storage/storageAccounts"
}
Example:
5. Export the connection string by copying the connection string and pasting it into the following
command. This string connects your system to the storage account.
$ export AZURE_STORAGE_CONNECTION_STRING="storage-connection-string"
Example:
[clouduser@localhost]$ export
AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;Endpoi
ntSuffix=core.windows.net;AccountName=azrhelclistact;AccountKey=NreGk...=="
28
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
Example:
{
"created": true
}
7. Create a virtual network. All cluster nodes must be in the same virtual network.
Example:
29
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": null
}
}
8. Create an availability set. All cluster nodes must be in the same availability set.
Example:
[omitted]
Additional resources
SKU Types
30
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
Setting Recommendation
Procedure
1. Enter the following grep command to determine if the required Hyper-V device drivers are
installed.
# lsinitrd | grep hv
# lsinitrd | grep hv
drwxr-xr-x 2 root root 0 Aug 12 14:21 usr/lib/modules/3.10.0-
31
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
932.el8.x86_64/kernel/drivers/hv
-rw-r--r-- 1 root root 31272 Aug 11 08:45 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/hv/hv_vmbus.ko.xz
-rw-r--r-- 1 root root 25132 Aug 11 08:46 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/net/hyperv/hv_netvsc.ko.xz
-rw-r--r-- 1 root root 9796 Aug 11 08:45 usr/lib/modules/3.10.0-
932.el8.x86_64/kernel/drivers/scsi/hv_storvsc.ko.xz
If all the drivers are not installed, complete the remaining steps.
NOTE
An hv_vmbus driver may exist in the environment. Even if this driver is present,
complete the following steps.
NOTE
Note the spaces before and after the quotes, for example, add_drivers+="
hv_vmbus ". This ensures that unique drivers are loaded in the event that other
Hyper-V drivers already exist in the environment.
# dracut -f -v --regenerate-all
Verification
2. Run the lsinitrd | grep hv command to verify that the drivers are installed.
Procedure
2. Register the VM, and enable the Red Hat Enterprise Linux 8 repository.
32
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
4. Create cloud-init configuration files that are needed for integration with Azure services:
a. To enable logging to the Hyper-V Data Exchange Service (KVP), create the
/etc/cloud/cloud.cfg.d/10-azure-kvp.cfg configuration file and add the following lines to
that file.
reporting:
logging:
type: log
telemetry:
type: hyperv
datasource_list: [ Azure ]
datasource:
Azure:
apply_network_config: False
5. To ensure that specific kernel modules are blocked from loading automatically, edit or create
the /etc/modprobe.d/blocklist.conf file and add the following lines to that file.
blacklist nouveau
blacklist lbm-nouveau
blacklist floppy
blacklist amdgpu
blacklist skx_edac
blacklist intel_cstate
# rm -f /etc/udev/rules.d/70-persistent-net.rules
# rm -f /etc/udev/rules.d/75-persistent-net-generator.rules
# rm -f /etc/udev/rules.d/80-net-name-slot-rules
b. To ensure that Accelerated Networking on Azure works as intended, create a new network
device rule /etc/udev/rules.d/68-azure-sriov-nm-unmanaged.rules and add the following
line to it.
33
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
a. Open the /etc/default/grub file, and ensure the GRUB_TIMEOUT line has the following
value.
GRUB_TIMEOUT=10
b. Remove the following options from the end of the GRUB_CMDLINE_LINUX line if present.
rhgb quiet
c. Ensure the /etc/default/grub file contains the following lines with all the specified options.
# grub2-mkconfig -o /boot/grub2/grub.cfg
On a UEFI-based machine:
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
If your system uses a non-default location for grub.cfg, adjust the command accordingly.
b. To ensure that a swap partition is not used in provisioned VMs, edit the following lines in the
/etc/waagent.conf file.
Provisioning.DeleteRootPassword=y
ResourceDisk.Format=n
ResourceDisk.EnableSwap=n
34
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
# subscription-manager unregister
NOTE
# export HISTSIZE=0
# poweroff
Prerequisites
Install the Azure Command Line Interface (CLI) .
Procedure
1. Ensure you are an Administrator or Owner for the Microsoft Azure subscription. You need this
authorization to create an Azure AD application.
$ az login
3. Enter the following command to create the Azure AD Application. To use your own password,
add the --password option to the command. Ensure that you create a strong password.
Example:
35
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
"password": "43a603f0-64bb-482e-800d-402efe5f3d47",
"tenant": "77ecefb6-xxxxxxxxxx-xxxxxxx-757a69cb9485"
}
4. Save the following information before proceeding. You need this information to set up the
fencing agent.
Azure AD Application ID
Tenant ID
Additional resources
Procedure
#!/bin/bash
MB=$((1024 * 1024))
size=$(qemu-img info -f raw --output json "$1" | gawk 'match($0, /"virtual-size": ([0-9]+),/, val)
{print val[1]}')
rounded_size=$((($size/$MB + 1) * $MB))
if [ $(($size % $MB)) -eq 0 ]
then
echo "Your image is already aligned. You do not need to resize."
exit 1
fi
echo "rounded size = $rounded_size"
export rounded_size
$ sh align.sh <image-xxx>.raw
If the message "Your image is already aligned. You do not need to resize." displays, proceed
to the following step.
36
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
4. Use the following command to convert the file to a fixed VHD format.
The sample uses qemu-img version 2.12.0.
5. If the raw image is not aligned, complete the following steps to align it.
a. Resize the raw file using the rounded value displayed when you ran the verification script.
NOTE
The exported storage connection string does not persist after a system reboot. If any of
the commands in the following steps fail, export the connection string again.
Procedure
1. Upload the VHD file to the storage container. It may take several minutes. To get a list of
storage containers, enter the az storage container list command.
Example:
2. Get the URL for the uploaded VHD file to use in the following step.
37
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Example:
NOTE
The default hypervisor generation of the VM is V1. You can optionally specify a
V2 hypervisor generation by including the option --hyper-v-generation V2.
Generation 2 VMs use a UEFI-based boot architecture. See Support for
generation 2 VMs on Azure for information on generation 2 VMs.
The command may return the error "Only blobs formatted as VHDs can be
imported." This error may mean that the image was not aligned to the nearest 1
MB boundary before it was converted to VHD.
Example:
Procedure
1. Launch an SSH terminal session and connect to the VM using the administrator name and public
IP address.
$ ssh administrator@PublicIP
To get the public IP address for an Azure VM, open the VM properties in the Azure Portal or
enter the following Azure CLI command.
Example:
38
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
$ sudo -i
# subscription-manager register --auto-attach
NOTE
# yum update -y
6. Install the Red Hat High Availability Add-On software packages, along with all available fencing
agents from the High Availability channel.
7. The user hacluster was created during the pcs and pacemaker installation in the previous step.
Create a password for hacluster on all cluster nodes. Use the same password for all nodes.
# passwd hacluster
8. Add the high availability service to the RHEL Firewall if firewalld.service is installed.
Verification
39
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Procedure
1. On one of the nodes, enter the following command to authenticate the pcs user hacluster. In
the command, specify the name of each node in the cluster.
Example:
Example:
[...]
Verification
40
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
A node that is unresponsive may still be accessing data. The only way to be certain that your data is safe
is to fence the node using STONITH. STONITH is an acronym for "Shoot The Other Node In The Head,"
and it protects your data from being corrupted by rogue nodes or concurrent access. Using STONITH,
you can be certain that a node is truly offline before allowing the data to be accessed from another
node.
Additional resources
Prerequisites
You need to set the cluster property stonith-enabled to true.
Procedure
1. Identify the Azure node name for each RHEL VM. You use the Azure node names to configure
the fence device.
# fence_azure_arm \
-l <AD-Application-ID> -p <AD-Password> \
--resourceGroup <MyResourceGroup> --tenantId <Tenant-ID> \
--subscriptionId <Subscription-ID> -o list
Example:
41
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
node01,
node02,
node03,
Example:
WARNING
For fence agents that provide a method option, do not specify a value of
cycle as it is not supported and can cause data corruption.
Some fence devices can fence only a single node, while other devices can fence multiple nodes.
The parameters you specify when you create a fencing device depend on what your fencing
device supports and requires.
You can use the pcmk_host_list parameter when creating a fencing device to specify all of the
machines that are controlled by that fencing device.
You can use pcmk_host_map parameter when creating a fencing device to map host names to
the specifications that comprehends the fence device.
Verification
Example:
42
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
3 nodes configured
1 resource configured
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
# pcs status
Example:
3 nodes configured
1 resource configured
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
Additional resources
43
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
The Azure internal load balancer removes cluster nodes that do not answer health probe requests.
Perform the following procedure to create an Azure internal load balancer. Each step references a
specific Microsoft procedure and includes the settings for customizing the load balancer for HA.
Prerequisites
Azure control panel
Procedure
1. Create a Basic load balancer . Select Internal load balancer, the Basic SKU, and Dynamic for
the type of IP address assignment.
2. Create a back-end address pool . Associate the backend pool to the availability set created while
creating Azure resources in HA. Do not set any target network IP configurations.
3. Create a health probe . For the health probe, select TCP and enter port 61000. You can use
TCP port number that does not interfere with another service. For certain HA product
applications (for example, SAP HANA and SQL Server), you may need to work with Microsoft to
identify the correct port to use.
4. Create a load balancer rule . To create the load balancing rule, the default values are
prepopulated. Ensure to set Floating IP (direct server return) to Enabled.
Procedure
2. Create the pcs resources and group. Use your load balancer FrontendIP for the IPaddr2
address.
Verification
44
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
Example output:
3 nodes configured
3 resources configured
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
NOTE
This is a stand-alone sample procedure for configuring block storage. The procedure
assumes that you have not yet created your cluster.
Prerequisites
You must have installed the Azure CLI on your host system and created your SSH key(s).
You must have created your cluster environment in Azure, which includes creating the following
resources. Links are to the Microsoft Azure documentation.
Resource group
Virtual network
Subnet(s)
45
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Storage account
Availability set
Procedure
1. Create a shared block volume using the Azure command az disk create.
For example, the following command creates a shared block volume named shared-block-
volume.vhd in the resource group sharedblock within the Azure Availability Zone
westcentralus.
{
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 5000,
"diskMbpsReadOnly": null,
"diskMbpsReadWrite": 200,
"diskSizeBytes": 1099511627776,
"diskSizeGb": 1024,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"hyperVgeneration": "V1",
"id": "/subscriptions/12345678910-12345678910/resourceGroups/sharedblock-
rg/providers/Microsoft.Compute/disks/shared-block-volume.vhd",
"location": "westcentralus",
"managedBy": null,
"managedByExtended": null,
"maxShares": 3,
"name": "shared-block-volume.vhd",
"networkAccessPolicy": "AllowAll",
"osType": null,
46
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
"provisioningState": "Succeeded",
"resourceGroup": "sharedblock-rg",
"shareInfo": null,
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
},
"tags": {},
"timeCreated": "2020-08-27T15:36:56.263382+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "cd8b0a25-6fbe-4779-9312-8d9cbb89b6f2",
"zones": null
}
2. Verify that you have created the shared block volume using the Azure command az disk show.
For example, the following command shows details for the shared block volume shared-block-
volume.vhd within the resource group sharedblock-rg.
{
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 5000,
"diskMbpsReadOnly": null,
"diskMbpsReadWrite": 200,
"diskSizeBytes": 1099511627776,
"diskSizeGb": 1024,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"hyperVgeneration": "V1",
"id": "/subscriptions/12345678910-12345678910/resourceGroups/sharedblock-
rg/providers/Microsoft.Compute/disks/shared-block-volume.vhd",
"location": "westcentralus",
"managedBy": null,
"managedByExtended": null,
"maxShares": 3,
"name": "shared-block-volume.vhd",
47
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
"networkAccessPolicy": "AllowAll",
"osType": null,
"provisioningState": "Succeeded",
"resourceGroup": "sharedblock-rg",
"shareInfo": null,
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
},
"tags": {},
"timeCreated": "2020-08-27T15:36:56.263382+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "cd8b0a25-6fbe-4779-9312-8d9cbb89b6f2",
"zones": null
}
3. Create three network interfaces using the Azure command az network nic create. Run the
following command three times using a different <nic_name> for each.
For example, the following command creates a network interface with the name shareblock-
nodea-vm-nic-protected.
4. Create three VMs and attach the shared block volume using the Azure command az vm create.
Option values are the same for each VM except that each VM has its own <vm_name>,
<new_vm_disk_name>, and <nic_name>.
$ az vm create \
-n <vm_name> -g <resource_group> --attach-data-disks
<shared_block_volume_name> \
--data-disk-caching None --os-disk-caching ReadWrite --os-disk-name <new-vm-
disk-name> \
--os-disk-size-gb <disk_size> --location <location> --size <virtual_machine_size> \
--image <image_name> --admin-username <vm_username> --authentication-type
ssh \
--ssh-key-values <ssh_key> --nics <nic_name> --availability-set <availability_set> --
ppg <proximity_placement_group>
$ az vm create \
-n sharedblock-nodea-vm -g sharedblock-rg --attach-data-disks shared-block-
volume.vhd \
48
CHAPTER 2. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON MICROSOFT AZURE
{
"fqdns": "",
"id": "/subscriptions/12345678910-12345678910/resourceGroups/sharedblock-
rg/providers/Microsoft.Compute/virtualMachines/sharedblock-nodea-vm",
"location": "westcentralus",
"macAddress": "00-22-48-5D-EE-FB",
"powerState": "VM running",
"privateIpAddress": "198.51.100.3",
"publicIpAddress": "",
"resourceGroup": "sharedblock-rg",
"zones": ""
}
Verification
1. For each VM in your cluster, verify that the block device is available by using the ssh command
with your VM’s IP address.
For example, the following command lists details including the host name and block device for
the VM IP 198.51.100.3.
nodea
sdb 8:16 0 1T 0 disk
2. Use the ssh command to verify that each VM in your cluster uses the same shared disk.
# ssh <ip_address> "hostname ; lsblk -d | grep ' 1T ' | awk '{print \$1}' | xargs -i
udevadm info --query=all --name=/dev/{} | grep '^E: ID_SERIAL='"
For example, the following command lists details including the host name and shared disk
volume ID for the instance IP address 198.51.100.3.
# ssh 198.51.100.3 "hostname ; lsblk -d | grep ' 1T ' | awk '{print \$1}' | xargs -i udevadm
info --query=all --name=/dev/{} | grep '^E: ID_SERIAL='"
nodea
E: ID_SERIAL=3600224808dd8eb102f6ffc5822c41d89
After you have verified that the shared disk is attached to each VM, you can configure resilient storage
for the cluster.
49
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Additional resources
50
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
To deploy a Red Hat Enterprise Linux 8 (RHEL 8) as an EC2 instance on Amazon Web Services (AWS),
follow the information below. This chapter:
Lists or refers to system requirements for your host system and virtual machine (VM)
Provides procedures for creating a custom VM from an ISO image, uploading it to EC2, and
launching an EC2 instance
IMPORTANT
While you can create a custom VM from an ISO image, Red Hat recommends that you use
the Red Hat Image Builder product to create customized images for use on specific cloud
providers. With Image Builder, you can create and upload an Amazon Machine Image
(AMI) in the ami format. See Composing a Customized RHEL System Image for more
information.
NOTE
For a list of Red Hat products that you can use securely on AWS, see Red Hat on Amazon
Web Services.
Prerequisites
Sign up for AWS and set up your AWS resources. See Setting Up with Amazon EC2 for more
information.
Enable your subscriptions in the Red Hat Cloud Access program . The Red Hat Cloud Access
program allows you to move your Red Hat subscriptions from physical or on-premise systems
onto AWS with full support from Red Hat.
51
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Choose to deploy a Red Leverage your existing Enable subscriptions The subscription
Hat Gold Image. Red Hat subscriptions. through the Red Hat includes the Red Hat
Cloud Access program, product cost; you pay
and then choose a Red Amazon for all other
Hat Gold Image on AWS. instance costs.
Choose to deploy an The AWS EC2 images Choose a RHEL image You pay Amazon hourly
existing Amazon image include a Red Hat when you launch an on a pay-as-you-go
that includes RHEL. product. instance on the AWS model. Such images are
Management Console, called "on-demand"
or choose an image images. Amazon
from the AWS provides support for on-
Marketplace. demand images.
NOTE
You can create a custom image for AWS using Red Hat Image Builder. See Composing a
Customized RHEL System Image for more information.
52
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
IMPORTANT
You cannot convert an on-demand instance to a Red Hat Cloud Access instance. To
change from an on-demand image to a Red Hat Cloud Access bring-your-own-
subscription (BYOS) image, create a new Red Hat Cloud Access instance and migrate
data from your on-demand instance. Cancel your on-demand instance after you migrate
your data to avoid double billing.
The following sections provide information and procedures related to custom images.
Additional resources
AWS Marketplace
Additional resources
Setting Recommendation
53
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Prerequisites
You have downloaded the latest Red Hat Enterprise Linux ISO image from the Red Hat
Customer Portal and moved the image to /var/lib/libvirt/images.
Procedure
1. Ensure that you have enabled your host machine for virtualization. See Enabling virtualization in
RHEL 8 for information and procedures.
2. Create and start a basic Red Hat Enterprise Linux VM. For instructions, see Creating virtual
machines.
a. If you use the command line to create your VM, ensure that you set the default memory and
CPUs to the capacity you want for the VM. Set your virtual network interface to virtio.
For example, the following command creates a kvmtest VM using the
/home/username/Downloads/rhel8.iso image:
# virt-install \
--name kvmtest --memory 2048 --vcpus 2 \
--cdrom /home/username/Downloads/rhel8.iso,bus=virtio \
--os-variant=rhel8.0
b. If you use the web console to create your VM, follow the procedure in Creating virtual
machines using the web console, with these caveats:
Before you start the installation, ensure that you have changed Model under Virtual
Network Interface Settings to virtio and change your vCPUs to the capacity settings
you want for the VM.
Procedure
1. Choose the language you want to use during the installation process.
b. Click Done.
Verify at least 500 MB for /boot. You can use the remaining space for root /.
54
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
Standard partitions are recommended, but you can use Logical Volume Management
(LVM).
You can use xfs, ext4, or ext3 for the file system.
a. Register the VM and enable the Red Hat Enterprise Linux 8 repository.
7. Important: This step is only for VMs you intend to upload to AWS.
a. For AMD64 or Intel 64 (x86_64)VMs, install the nvme, xen-netfront, and xen-blkfront
drivers.
Alternatively, you can add the drivers to /etc/dracut.conf.d/ and then enter dracut -f to
overwrite the existing initramfs file.
Additional resources
Introduction to cloud-init
Many of the procedures required to manage HA clusters in AWS include using the AWS CLI. Complete
55
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Many of the procedures required to manage HA clusters in AWS include using the AWS CLI. Complete
the following steps to install the AWS CLI.
Prerequisites
You have created an AWS Access Key ID and an AWS Secret Access Key, and have access to
them. For instructions and details, see Quickly Configuring the AWS CLI.
Procedure
1. Install the AWS command line tools using the yum command.
2. Use the aws --version command to verify that you installed the AWS CLI.
$ aws --version
aws-cli/1.19.77 Python/3.6.15 Linux/5.14.16-201.fc34.x86_64 botocore/1.20.77
3. Configure the AWS command line client according to your AWS access details.
$ aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
Additional resources
Procedure
b. Enter a Region.
c. Click Next.
4. In the Configure options view, select the desired options and click Next.
56
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
5. In the Set permissions view, change or accept the default options and click Next.
NOTE
Alternatively, you can use the AWS CLI to create a bucket. For example, the aws
s3 mb s3://my-new-bucket command creates an S3 bucket named my-new-
bucket. See the AWS CLI Command Reference for more information on the mb
command.
Additional resources
Amazon S3 Console
Procedure
1. Create a file named trust-policy.json and include the following policy. Save the file on your
system and note its location.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "vmie.amazonaws.com" },
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals":{
"sts:Externalid": "vmimport"
}
}
}
]
}
2. Use the create role command to create the vmimport role. Specify the full path to the location
of the trust-policy.json file. Prefix file:// to the path. For example:
3. Create a file named role-policy.json and include the following policy. Replace s3-bucket-name
with the name of your S3 bucket.
57
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"s3:GetBucketLocation",
"s3:GetObject",
"s3:ListBucket"
],
"Resource":[
"arn:aws:s3:::s3-bucket-name",
"arn:aws:s3:::s3-bucket-name/*"
]
},
{
"Effect":"Allow",
"Action":[
"ec2:ModifySnapshotAttribute",
"ec2:CopySnapshot",
"ec2:RegisterImage",
"ec2:Describe*"
],
"Resource":"*"
}
]
}
4. Use the put-role-policy command to attach the policy to the role you created. Specify the full
path of the role-policy.json file. For example:
Additional resources
Procedure
58
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
NOTE
This procedure could take a few minutes. After completion, you can check that
your image uploaded successfully to your S3 bucket using the AWS S3 Console.
Additional resources
AWS S3 Console
Procedure
1. Create a file to specify a bucket and path for your image. Name the file containers.json. In the
sample that follows, replace s3-bucket-name with your bucket name and s3-key with your key.
You can get the key for the image using the Amazon S3 Console.
{
"Description": "rhel-8.0-sample.raw",
"Format": "raw",
"UserBucket": {
"S3Bucket": "s3-bucket-name",
"S3Key": "s3-key"
}
}
2. Import the image as a snapshot. This example uses a public Amazon S3 file; you can use the
Amazon S3 Console to change permissions settings on your bucket.
The terminal displays a message such as the following. Note the ImportTaskID within the
message.
{
"SnapshotTaskDetail": {
"Status": "active",
"Format": "RAW",
"DiskImageSize": 0.0,
"UserBucket": {
"S3Bucket": "s3-bucket-name",
"S3Key": "rhel-8.0-sample.raw"
},
"Progress": "3",
"StatusMessage": "pending"
59
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
},
"ImportTaskId": "import-snap-06cea01fa0f1166a8"
}
3. Track the progress of the import using the describe-import-snapshot-tasks command. Include
the ImportTaskID.
The returned message shows the current status of the task. When complete, Status shows
completed. Within the status, note the snapshot ID.
Additional resources
Amazon S3 Console
Procedure
7. Click Create. In the note regarding image creation, there is a link to your image.
NOTE
60
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
NOTE
Alternatively, you can use the AWS CLI register-image command to create an
AMI from a snapshot. See register-image for more information. An example
follows.
You must specify the root device volume /dev/sda1 as your root-device-name.
For conceptual information on device mapping for AWS, see Example block
device mapping.
Procedure
1. From the AWS EC2 Dashboard, select Images and then AMIs.
3. Choose an Instance Type that meets or exceeds the requirements of your workload.
See Amazon EC2 Instance Types for information on instance types.
b. For Network, select the VPC you created when setting up your AWS environment . Select a
subnet for the instance or create a new subnet.
NOTE
5. Click Next: Add Storage. Verify that the default storage is sufficient.
NOTE
Tags can help you manage your AWS resources. See Tagging Your Amazon EC2
Resources for information on tagging.
7. Click Next: Configure Security Group. Select the security group you created when setting up
61
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
7. Click Next: Configure Security Group. Select the security group you created when setting up
your AWS environment.
9. Click Launch. You are prompted to select an existing key pair or create a new key pair. Select
the key pair you created when setting up your AWS environment .
NOTE
Verify that the permissions for your private key are correct. Use the command
options chmod 400 <keyname>.pem to change the permissions, if necessary.
NOTE
Alternatively, you can launch an instance using the AWS CLI. See Launching,
Listing, and Terminating Amazon EC2 Instances in the Amazon documentation
for more information.
Additional resources
Prerequisites
Procedure
You can use an activation key to attach subscriptions. See Creating Red Hat Customer
Portal Activation Keys for more information.
Alternatively, you can manually attach a subscription using the ID of the subscription pool
62
CHAPTER 3. DEPLOYING A RED HAT ENTERPRISE LINUX IMAGE AS AN EC2 INSTANCE ON AMAZON WEB SERVICES
Alternatively, you can manually attach a subscription using the ID of the subscription pool
(Pool ID). See Attaching and Removing Subscriptions Through the Command Line .
Additional resources
Prerequisites
You have downloaded the latest RHEL 8 Gold Image for AWS. For instructions, see Using Gold
Images on AWS.
NOTE
An AWS account can only be attached to a single Red Hat account at a time.
Therefore, ensure no other users require access to the AWS account before
attaching it to your Red Hat one.
Procedure
1. Upload the Gold Image to AWS. For instructions, see Uploading the Red Hat Enterprise Linux
image to AWS.
2. Create VMs using the uploaded image. They will be automatically subscribed to RHSM.
Verification
In a RHEL 8 VM created using the above instructions, verify the system is registered to RHSM
by executing the subscription-manager identity command. On a successfully registered
system, this displays the UUID of the system. For example:
# subscription-manager identity
system identity: fdc46662-c536-43fb-a18a-bbcb283102b7
name: 192.168.122.222
org name: 6340056
org ID: 6340056
Additional resources
63
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
64
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
Prerequisite procedures for setting up your environment for AWS. Once you have set up your
environment, you can create and configure EC2 instances.
Procedures specific to the creation of HA clusters, which transform individual nodes into a
cluster of HA nodes on AWS. These include procedures for installing the High Availability
packages and agents on each cluster node, configuring fencing, and installing AWS network
resource agents.
Prerequisites
Sign up for AWS and set up your AWS resources. See Setting Up with Amazon EC2 for more
information.
Enable your subscriptions in the Red Hat Cloud Access program . The Red Hat Cloud Access
program allows you to move your Red Hat subscriptions from physical or on-premise systems
onto AWS with full support from Red Hat.
4.1. CREATING THE AWS ACCESS KEY AND AWS SECRET ACCESS KEY
You need to create an AWS Access Key and AWS Secret Access Key before you install the AWS CLI.
The fencing and resource agent APIs use the AWS Access Key and Secret Access Key to connect to
each node in the cluster.
Prerequisites
Your IAM user account must have Programmatic access. See Setting up the AWS Environment
for more information.
Procedure
2. Click on your AWS Account ID to display the drop-down menu and select My Security
Credentials.
3. Click Users.
65
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
7. Download the .csv file (or save both keys). You need to enter these keys when creating the
fencing device.
Prerequisites
You have created an AWS Access Key ID and an AWS Secret Access Key, and have access to
them. For instructions and details, see Quickly Configuring the AWS CLI.
Procedure
1. Install the AWS command line tools using the yum command.
2. Use the aws --version command to verify that you installed the AWS CLI.
$ aws --version
aws-cli/1.19.77 Python/3.6.15 Linux/5.14.16-201.fc34.x86_64 botocore/1.20.77
3. Configure the AWS command line client according to your AWS access details.
$ aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:
Additional resources
You can create and upload a custom image that you use for your cluster nodes, or you could choose a
Gold Image (Cloud Access image) or an on-demand image.
Prerequisites
You need to have set up an AWS environment. See Setting Up with Amazon EC2 for more
information.
66
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
Procedure
1. From the AWS EC2 Dashboard, select Images and then AMIs.
3. Choose an Instance Type that meets or exceeds the requirements of your workload. Depending
on your HA application, each instance may need to have higher capacity.
See Amazon EC2 Instance Types for information on instance types.
a. Enter the Number of instances you want to create for the cluster. This example procedure
uses three cluster nodes.
NOTE
b. For Network, select the VPC you created in Set up the AWS environment. Select the
subnet for the instance to create a new subnet.
c. Select Enable for Auto-assign Public IP. These are the minimum selections you need to
make for Configure Instance Details. Depending on your specific HA application, you may
need to make additional selections.
NOTE
5. Click Next: Add Storage and verify that the default storage is sufficient. You do not need to
modify these settings unless your HA application requires other storage options.
NOTE
Tags can help you manage your AWS resources. See Tagging Your Amazon EC2
Resources for information on tagging.
7. Click Next: Configure Security Group. Select the existing security group you created in Setting
up the AWS environment.
9. Click Launch. You are prompted to select an existing key pair or create a new key pair. Select
the key pair you created when Setting up the AWS environment.
NOTE
67
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
NOTE
Alternatively, you can launch instances using the AWS CLI. See Launching,
Listing, and Terminating Amazon EC2 Instances in the Amazon documentation
for more information.
Additional resources
Procedure
1. Move the key file from the Downloads directory to your Home directory or to your ~/.ssh
directory.
2. Change the permissions of the key file so that only the root user can read it.
Procedure
3. From your SSH terminal session, connect to the instance using the AWS example provided in
the pop-up window. Add the correct path to your KeyName.pem file if the path is not shown in
the example.
Procedure
1. Remove the AWS Red Hat Update Infrastructure (RHUI) client. Because you are going to use a
Red Hat Cloud Access subscription, you should not use AWS RHUI in addition to your
subscription.
68
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
$ sudo -i
# yum -y remove rh-amazon-rhui-client*
# yum update -y
6. Install the Red Hat High Availability Add-On software packages, along with all available fencing
agents from the High Availability channel.
7. The user hacluster was created during the pcs and pacemaker installation in the previous
step. Create a password for hacluster on all cluster nodes. Use the same password for all nodes.
# passwd hacluster
8. Add the high availability service to the RHEL Firewall if firewalld.service is installed.
10. Edit /etc/hosts and add RHEL host names and internal IP addresses. See How should the
/etc/hosts file be set up on RHEL cluster nodes? for details.
Verification
69
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
man:pcs(8)
Main PID: 5437 (pcsd)
CGroup: /system.slice/pcsd.service
└─5437 /usr/bin/ruby /usr/lib/pcsd/pcsd > /dev/null &
Mar 01 14:53:27 ip-10-0-0-48.ec2.internal systemd[1]: Starting PCS GUI and remote
configuration interface…
Mar 01 14:53:28 ip-10-0-0-48.ec2.internal systemd[1]: Started PCS GUI and remote
configuration interface.
Procedure
1. On one of the nodes, enter the following command to authenticate the pcs user hacluster. In
the command, specify the name of each node in the cluster.
Example:
Example:
[...]
Verification
70
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
You can configure fencing on AWS cluster using multiple methods. This section provides the following:
Standard procedure
1. Enter the following AWS metadata query to get the Instance ID for each node. You need these
IDs to configure the fence device. See Instance Metadata and User Data for additional
information.
Example:
2. Enter the following command to configure the fence device. Use the pcmk_host_map
command to map the RHEL host name to the Instance ID. Use the AWS Access Key and AWS
Secret Access Key that you previously set up.
# pcs stonith \
create <name> fence_aws access_key=access-key secret_key=<secret-access-key> \
region=<region> pcmk_host_map="rhel-hostname-1:Instance-ID-1;rhel-hostname-
2:Instance-ID-2;rhel-hostname-3:Instance-ID-3" \
power_timeout=240 pcmk_reboot_timeout=480 pcmk_reboot_retries=4
Example:
71
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
region=us-east-1 pcmk_host_map="ip-10-0-0-48:i-07f1ac63af0ec0ac6;ip-10-0-0-46:i-
063fc5fe93b4167b2;ip-10-0-0-58:i-08bd39eb03a6fd2c7" \
power_timeout=240 pcmk_reboot_timeout=480 pcmk_reboot_retries=4
Alternate procedure
3. Use the obtained instance IDs to configure fencing on each node on the cluster. For example:
Verification
NOTE
The command response may take several minutes to display. If you watch the
active terminal session for the node being fenced, you see that the terminal
connection is immediately terminated after you enter the fence command.
Example:
72
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
# pcs status
Example:
3 nodes configured
1 resource configured
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
# pcs status
Example:
3 nodes configured
1 resource configured
73
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
Prerequisites
You must have created an AWS Access Key and AWS Secret Access Key. See Creating the
AWS Access Key and AWS Secret Access Key for more information.
Procedure
1. Install the AWS CLI. For instructions, see Installing the AWS CLI .
2. Verify that the AWS CLI is configured properly. The instance IDs and instance names should
display.
Example:
i-07f1ac63af0ec0ac6
ip-10-0-0-48
i-063fc5fe93b4167b2
ip-10-0-0-46
i-08bd39eb03a6fd2c7
ip-10-0-0-58
Add the two resources to the same group to enforce order and colocation constraints.
Complete the following procedure to add a secondary private IP address and create a virtual IP. You can
complete this procedure from any node in the cluster.
74
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
Procedure
1. View the AWS Secondary Private IP Address resource agent (awsvip) description. This shows
the options and default operations for this agent.
2. Create the Secondary Private IP address using an unused private IP address in the VPC CIDR
block.
Example:
3. Create a virtual IP resource. This is a VPC IP address that can be rapidly remapped from the
fenced node to the failover node, masking the failure of the fenced node within the subnet.
Example:
root@ip-10-0-0-48 ~]# pcs resource create vip IPaddr2 ip=10.0.0.68 --group networking-
group
Verification
# pcs status
Example:
3 nodes configured
3 resources configured
75
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
An elastic IP address is a public IP address that can be rapidly remapped from the fenced node to the
failover node, masking the failure of the fenced node.
Note that this is different from the virtual IP resource created earlier. The elastic IP address is used for
public-facing Internet connections instead of subnet connections.
1. Add the two resources to the same group that was previously created to enforce order and
colocation constraints.
3. View the AWS Secondary Elastic IP Address resource agent (awseip) description. The following
command shows the options and default operations for this agent.
4. Create the Secondary Elastic IP address resource using the allocated IP address created in
Step 1.
Example:
Verification
Enter the pcs status command to verify that the resource is running.
# pcs status
Example:
76
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
3 nodes configured
4 resources configured
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
Enter the following commands to verify the virtual IP (awsvip) and elastic IP (awseip) resources are
working.
Procedure
1. Launch an SSH session from your local workstation to the elastic IP address previously created.
Example:
2. Verify that the host you connected to via SSH is the host associated with the elastic resource
created.
Additional resources
Prerequisites
Procedure
77
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
For example, the following command creates a volume in the us-east-1a availability zone.
{
"AvailabilityZone": "us-east-1a",
"CreateTime": "2020-08-27T19:16:42.000Z",
"Encrypted": false,
"Size": 1024,
"SnapshotId": "",
"State": "creating",
"VolumeId": "vol-042a5652867304f09",
"Iops": 51200,
"Tags": [ ],
"VolumeType": "io1"
}
NOTE
2. For each instance in your cluster, attach a shared block volume using the AWS command
attach-volume. Use your <instance_id> and <volume_id>.
For example, the following command attaches a shared block volume vol-042a5652867304f09
to instance i-0eb803361c2c887f2.
{
"AttachTime": "2020-08-27T19:26:16.086Z",
"Device": "/dev/xvdd",
"InstanceId": "i-0eb803361c2c887f2",
"State": "attaching",
"VolumeId": "vol-042a5652867304f09"
}
Verification
1. For each instance in your cluster, verify that the block device is available by using the ssh
command with your instance <ip_address>.
78
CHAPTER 4. CONFIGURING A RED HAT HIGH AVAILABILITY CLUSTER ON AWS
For example, the following command lists details including the host name and block device for
the instance IP 198.51.100.3.
nodea
nvme2n1 259:1 0 1T 0 disk
2. Use the ssh command to verify that each instance in your cluster uses the same shared disk.
# ssh <ip_address> "hostname ; lsblk -d | grep ' 1T ' | awk '{print \$1}' | xargs -i
udevadm info --query=all --name=/dev/{} | grep '^E: ID_SERIAL='"
For example, the following command lists details including the host name and shared disk
volume ID for the instance IP address 198.51.100.3.
# ssh 198.51.100.3 "hostname ; lsblk -d | grep ' 1T ' | awk '{print \$1}' | xargs -i udevadm
info --query=all --name=/dev/{} | grep '^E: ID_SERIAL='"
nodea
E: ID_SERIAL=Amazon Elastic Block Store_vol0fa5342e7aedf09f7
Additional resources
79
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Lists or refers to system requirements for your host system and virtual machine (VM)
Provides procedures for creating a custom VM from an ISO image, uploading it to GCE, and
launching an instance
NOTE
For a list of Red Hat product certifications for GCP, see Red Hat on Google Cloud
Platform.
IMPORTANT
You can create a custom VM from an ISO image, but Red Hat recommends that you use
the Red Hat Image Builder product to create customized images for use on specific cloud
providers. See Composing a Customized RHEL System Image for more information.
Prerequisites
You need a Red Hat Customer Portal account to complete the procedures in this chapter.
Create an account with GCP to access the Google Cloud Platform Console. See Google Cloud
for more information.
Enable your Red Hat subscriptions through the Red Hat Cloud Access program . The Red Hat
Cloud Access program allows you to move your Red Hat subscriptions from physical or on-
premise systems onto GCP with full support from Red Hat.
80
NG A RED HAT ENTERPRISE LINUX IMAGE AS A GOOGLE COMPUTE ENGINE INSTANCE ON GOOGLE CLOUD PLATFORM
Choose to deploy a Red Use your existing Red Enable subscriptions The subscription
Hat Gold Image. Hat subscriptions. through the Red Hat includes the Red Hat
Cloud Access program, product cost; you pay
and then choose a Red Google for all other
Hat Gold Image on instance costs.
Google Cloud Platform.
See the Red Hat Cloud Red Hat Gold Images
Access Reference Guide are called "Cloud
for details on Gold Access" images because
Images and how to you use your existing
access them on Google Red Hat subscriptions.
Cloud Platform. Red Hat provides
support directly for
Cloud Access images.
Choose to deploy a Use your existing Red Enable subscriptions The subscription
custom image that you Hat subscriptions. through the Red Hat includes the Red Hat
move to GCP. Cloud Access program, product cost; you pay all
upload your custom other instance costs.
image, and attach your
subscriptions. Custom images that you
move to GCP are called
"Cloud Access" images
because you use your
existing Red Hat
subscriptions. Red Hat
provides support directly
for Cloud Access
images.
Choose to deploy an The GCP images include Choose a RHEL image You pay GCP hourly on
existing GCP image that a Red Hat product. when you launch an a pay-as-you-go model.
includes RHEL. instance on the GCP Such images are called
Compute Engine, or "on-demand" images.
choose an image from GCP offers support for
the Google Cloud on-demand images
Platform Marketplace. through a support
agreement.
IMPORTANT
You cannot convert an on-demand instance to a Red Hat Cloud Access instance. To
change from an on-demand image to a Red Hat Cloud Access bring-your-own-
subscription (BYOS) image, create a new Red Hat Cloud Access instance and migrate
data from your on-demand instance. Cancel your on-demand instance after you migrate
your data to avoid double billing.
The following sections provide information and procedures related to custom images.
Additional resources
81
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
Additional resources
Setting Recommendation
Prerequisites
You have downloaded the latest Red Hat Enterprise Linux ISO image from the Red Hat
Customer Portal and moved the image to /var/lib/libvirt/images.
Procedure
1. Ensure that you have enabled your host machine for virtualization. See Enabling virtualization in
82
NG A RED HAT ENTERPRISE LINUX IMAGE AS A GOOGLE COMPUTE ENGINE INSTANCE ON GOOGLE CLOUD PLATFORM
1. Ensure that you have enabled your host machine for virtualization. See Enabling virtualization in
RHEL 8 for information and procedures.
2. Create and start a basic Red Hat Enterprise Linux VM. For instructions, see Creating virtual
machines.
a. If you use the command line to create your VM, ensure that you set the default memory and
CPUs to the capacity you want for the VM. Set your virtual network interface to virtio.
For example, the following command creates a kvmtest VM using the
/home/username/Downloads/rhel8.iso image:
# virt-install \
--name kvmtest --memory 2048 --vcpus 2 \
--cdrom /home/username/Downloads/rhel8.iso,bus=virtio \
--os-variant=rhel8.0
b. If you use the web console to create your VM, follow the procedure in Creating virtual
machines using the web console, with these caveats:
Before you start the installation, ensure that you have changed Model under Virtual
Network Interface Settings to virtio and change your vCPUs to the capacity settings
you want for the VM.
Procedure
1. Choose the language you want to use during the installation process.
b. Click Done.
Verify at least 500 MB for /boot. You can use the remaining space for root /.
Standard partitions are recommended, but you can use Logical Volume Management
(LVM).
You can use xfs, ext4, or ext3 for the file system.
83
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
a. Register the VM and enable the Red Hat Enterprise Linux 8 repository.
Additional resources
Introduction to cloud-init
Prerequisites
You must have an account with GCP. If you do not, see Google Cloud for more information.
Procedure
4. From the New Project window, enter a name for your new project.
5. Check Organization. Click the drop-down menu to change the organization, if necessary.
6. Confirm the Location of your parent organization or folder. Click Browse to search for and
change this value, if necessary.
NOTE
84
NG A RED HAT ENTERPRISE LINUX IMAGE AS A GOOGLE COMPUTE ENGINE INSTANCE ON GOOGLE CLOUD PLATFORM
NOTE
Once you have installed the Google Cloud SDK, you can use the gcloud projects
create CLI command to create a project. For example:
The example creates a project with the project ID my-gcp-project3 and the
project name project3. See gcloud project create for more information.
Additional resources
Procedure
1. Follow the GCP instructions for downloading and extracting the Google Cloud SDK archive. See
the GCP document Quickstart for Linux for details.
2. Follow the same instructions for initializing the Google Cloud SDK.
NOTE
Once you have initialized the Google Cloud SDK, you can use the gcloud CLI
commands to perform tasks and obtain information about your project and
instances. For example, you can display project information with the gcloud
compute project-info describe --project <project-name> command.
Additional resources
Procedure
1. Use the ssh-keygen command to generate an SSH key pair for use with GCE.
2. From the GCP Console Dashboard page , click the Navigation menu to the left of the Google
Cloud Console banner and select Compute Engine and then select Metadata.
85
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
4. Enter the output generated from the ~/.ssh/google_compute_engine.pub file and click Save.
You can now connect to your instance using standard SSH.
NOTE
You can run the gcloud compute config-ssh command to populate your config file with
aliases for your instances. The aliases allow simple SSH connections by instance name.
For information on the gcloud compute config-ssh command, see gcloud compute
config-ssh.
Additional resources
Connecting to instances
Procedure
1. If you are not already logged in to GCP, log in with the following command.
# gsutil mb gs://bucket_name
NOTE
Alternatively, you can use the Google Cloud Console to create a bucket. See
Create a bucket for information.
Additional resources
Create a bucket
Procedure
1. Run the qemu-img command to convert your image. The converted image must have the name
disk.raw.
86
NG A RED HAT ENTERPRISE LINUX IMAGE AS A GOOGLE COMPUTE ENGINE INSTANCE ON GOOGLE CLOUD PLATFORM
3. Upload the image to the bucket you created previously. Upload could take a few minutes.
4. From the Google Cloud Platform home screen, click the collapsed menu icon and select
Storage and then select Browser.
NOTE
You can also upload your image using the GCP Console. To do so, click the name
of your bucket and then click Upload files.
Additional resources
Procedure
1. Run the following command to create an image for GCE. Specify the name of the image you are
creating, the bucket name, and the name of the tarred image.
NOTE
Alternatively, you can use the Google Cloud Console to create an image. See
Creating, deleting, and deprecating custom images for more information.
a. Click the Navigation menu to the left of the Google Cloud Console banner.
Additional resources
87
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
NOTE
The following procedure provides instructions for creating a basic VM instance using the
GCP Console. See Creating and starting a VM instance for more information on GCE VM
instances and their configuration options.
Procedure
1. From the GCP Console Dashboard page , click the Navigation menu to the left of the Google
Cloud Console banner and select Compute Engine and then select Images.
6. Choose a Machine configuration that meets or exceeds the requirements of your workload.
8. Optionally, under Firewall, select Allow HTTP traffic or Allow HTTPS traffic.
9. Click Create.
NOTE
11. From the GCP Console Dashboard, click the Navigation menu to the left of the Google Cloud
Console banner and select Compute Engine and then select VM instances.
NOTE
88
NG A RED HAT ENTERPRISE LINUX IMAGE AS A GOOGLE COMPUTE ENGINE INSTANCE ON GOOGLE CLOUD PLATFORM
NOTE
Alternatively, you can use the gcloud compute instances create CLI command
to create a GCE VM instance from an image. A simple example follows.
Procedure
1. Run the following command to ensure that your instance is running. The command lists
information about your GCE instance, including whether the instance is running, and, if so, the
public IP address of the running instance.
2. Connect to your instance using standard SSH. The example uses the google_compute_engine
key created earlier.
NOTE
GCP offers a number of ways to SSH into your instance. See Connecting to
instances for more information. You can also connect to your instance using the
root account and password you set previously.
Additional resources
Connecting to instances
Prerequisites
Procedure
89
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
You can use an activation key to attach subscriptions. See Creating Red Hat Customer
Portal Activation Keys for more information.
Alternatively, you can manually attach a subscription using the ID of the subscription pool
(Pool ID). See Attaching and Removing Subscriptions Through the Command Line .
Additional resources
Google Cloud
90
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
Prerequisite procedures for setting up your environment for GCP. Once you have set up your
environment, you can create and configure VM instances.
Procedures specific to the creation of HA clusters, which transform individual nodes into a
cluster of HA nodes on GCP. These include procedures for installing the High Availability
packages and agents on each cluster node, configuring fencing, and installing network resource
agents.
Prerequisites
You must be enrolled in the Red Hat Cloud Access program and have unused RHEL
subscriptions. The attached subscription must include access to the following repositories for
each GCP instance.
You must belong to an active GCP project and have sufficient permissions to create resources
in the project.
Your project should have a service account that belongs to a VM instance and not an individual
user. See Using the Compute Engine Default Service Account for information about using the
default service account instead of creating a separate service account.
If you or your project administrator create a custom service account, the service account should be
configured for the following roles.
Compute Admin
Logging Admin
Monitoring Editor
Storage Admin
91
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
To create and configure a base image of RHEL, your host system must have the following packages
installed.
Choose to deploy a Red Use your existing Red Enable subscriptions The subscription
Hat Gold Image. Hat subscriptions. through the Red Hat includes the Red Hat
Cloud Access program, product cost; you pay
and then choose a Red Google for all other
Hat Gold Image on instance costs.
Google Cloud Platform.
See the Red Hat Cloud Red Hat Gold Images
Access Reference Guide are called "Cloud
for details on Gold Access" images because
Images and how to you use your existing
access them on Google Red Hat subscriptions.
Cloud Platform. Red Hat provides
support directly for
Cloud Access images.
92
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
Choose to deploy a Use your existing Red Enable subscriptions The subscription
custom image that you Hat subscriptions. through the Red Hat includes the Red Hat
move to GCP. Cloud Access program, product cost; you pay all
upload your custom other instance costs.
image, and attach your
subscriptions. Custom images that you
move to GCP are called
"Cloud Access" images
because you use your
existing Red Hat
subscriptions. Red Hat
provides support directly
for Cloud Access
images.
Choose to deploy an The GCP images include Choose a RHEL image You pay GCP hourly on
existing GCP image that a Red Hat product. when you launch an a pay-as-you-go model.
includes RHEL. instance on the GCP Such images are called
Compute Engine, or "on-demand" images.
choose an image from GCP offers support for
the Google Cloud on-demand images
Platform Marketplace. through a support
agreement.
IMPORTANT
You cannot convert an on-demand instance to a Red Hat Cloud Access instance. To
change from an on-demand image to a Red Hat Cloud Access bring-your-own-
subscription (BYOS) image, create a new Red Hat Cloud Access instance and migrate
data from your on-demand instance. Cancel your on-demand instance after you migrate
your data to avoid double billing.
The following sections provide information and procedures related to custom images.
Additional resources
Procedure
1. Follow the GCP instructions for downloading and extracting the Google Cloud SDK archive. See
93
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
1. Follow the GCP instructions for downloading and extracting the Google Cloud SDK archive. See
the GCP document Quickstart for Linux for details.
2. Follow the same instructions for initializing the Google Cloud SDK.
NOTE
Once you have initialized the Google Cloud SDK, you can use the gcloud CLI
commands to perform tasks and obtain information about your project and
instances. For example, you can display project information with the gcloud
compute project-info describe --project <project-name> command.
Additional resources
Prerequisites
Procedure
1. If you are not already logged in to Google Cloud Platform, log in with the following command.
$ gsutil mb gs://BucketName
Example:
$ gsutil mb gs://rhel-ha-bucket
Additional resources
Make buckets
Procedure
94
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
Procedure
5. Under the New subnet, create a Custom subnet in the region where you want to create the
cluster.
6. Click Create.
Procedure
1. Convert the file. Images uploaded to GCP must be in raw format and named disk.raw.
Procedure
Example:
2. Create a template instance from the image. The minimum size required for a base RHEL
95
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
2. Create a template instance from the image. The minimum size required for a base RHEL
instance is n1-standard-2. See gcloud compute instances create for additional configuration
options.
Example:
$ ssh root@PublicIPaddress
# yum update -y
5. Install the GCP Linux Guest Environment on the running instance (in-place installation).
See Install the guest environment in-place for instructions.
7. Copy the command script and paste it at the command prompt to run the script immediately.
8. Make the following configuration changes to the instance. These changes are based on GCP
recommendations for custom images. See gcloudcompute images list for more information.
96
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
# rm -f /etc/udev/rules.d/70-persistent-net.rules
# rm -f /etc/udev/rules.d/75-persistent-net-generator.rules
# chkconfig network on
g. (Optional) Edit the /etc/ssh/ssh_config file and add the following lines to the end of the
file. This keeps your SSH session active during longer periods of inactivity.
h. Edit the /etc/ssh/sshd_config file and make the following changes, if necessary. The
ClientAliveInterval 420 setting is optional; this keeps your SSH session active during longer
periods of inactivity.
PermitRootLogin no
PasswordAuthentication no
AllowTcpForwarding yes
X11Forwarding no
PermitTunnel no
# Compute times out connections after 10 minutes of inactivity.
# Keep ssh connections alive by sending a packet every 7 minutes.
ClientAliveInterval 420
ssh_pwauth from 1 to 0.
ssh_pwauth: 0
IMPORTANT
97
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
# subscription-manager unregister
11. Clean the shell history. Keep the instance running for the next procedure.
# export HISTSIZE=0
Procedure
# sync
3. On your host system, create the configured image from the snapshot.
Additional resources
Procedure
Example:
98
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
gcp/global/instanceTemplates/rhel-81-instance-template].
NAME MACHINE_TYPE PREEMPTIBLE CREATION_TIMESTAMP
rhel-81-instance-template n1-standard-2 2018-07-25T11:09:30.506-07:00
Example:
Procedure
1. In the Google Cloud Console, select Compute Engine and then select VM instances.
2. Select the instance, click the arrow next to SSH, and select the View gcloud command option.
3. Paste this command at a command prompt for passwordless access to the instance.
4. Enable sudo account access and register with Red Hat Subscription Manager.
8. Install pcs pacemaker, the fence agents, and the resource agents.
99
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
# yum update -y
Procedure
1. The user hacluster was created during the pcs and pacemaker installation in the previous
step. Create a password for the user hacluster on all cluster nodes. Use the same password for
all nodes.
# passwd hacluster
# firewall-cmd --reload
Verification
2. Edit the /etc/hosts file. Add RHEL host names and internal IP addresses for all nodes.
Additional resources
100
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
Procedure
1. On one of the nodes, authenticate the pcs user. Specify the name of each node in the cluster in
the command.
Verification
1. Run the following command to enable nodes to join the cluster automatically when started.
Note that for most default configurations, the GCP instance names and the RHEL host names are
identical.
Procedure
1. Obtain GCP instance names. Note that the output of the following command also shows the
internal ID for the instance.
Example:
101
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
4435801234567893181,InstanceName-3
4081901234567896811,InstanceName-1
7173601234567893341,InstanceName-2
Verification
# pcs status
Example:
3 nodes configured
3 resources configured
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
Procedure
Enter the following command on each node to initialize each node with your project ID and account
credentials.
# gcloud-ra init
The gcp-vpc-move-vip resource agent attaches a secondary IP address (alias IP) to a running instance.
102
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
The gcp-vpc-move-vip resource agent attaches a secondary IP address (alias IP) to a running instance.
This is a floating IP address that can be passed between different nodes in the cluster.
You can configure the resource agent to use a primary subnet address range or a secondary subnet
address range:
Complete the following steps to configure the resource for the primary VPC subnet.
Procedure
1. Create the aliasip resource. Include an unused internal IP address. Include the CIDR block in the
command.
Example:
Example:
Verification
1. Verify that the resources have started and are grouped under vipgrp.
# pcs status
Example:
103
Red Hat Enterprise Linux 8 Deploying Red Hat Enterprise Linux 8 on public cloud platforms
# pcs status
Complete the following steps to configure the resource for a secondary subnet address range.
Prerequisites
Procedure
Example:
2. Create the aliasip resource. Create an unused internal IP address in the secondary subnet
address range. Include the CIDR block in the command.
Example:
Example:
Verification
1. Verify that the resources have started and are grouped under vipgrp.
# pcs status
104
CHAPTER 6. CONFIGURING RED HAT HIGH AVAILABILITY CLUSTER ON GOOGLE CLOUD PLATFORM
Example:
# pcs status
Design Guidance for RHEL High Availability Clusters - Selecting the Transport Protocol
105