Deploying RHEL 8 on Google Cloud Platform Red Hat Enterprise Linux 8 Obtaining RHEL system images and creating RHEL instances on GCP Red Hat Customer Content Services

Commands:
provider = "gcp" [settings] bucket = "GCP_BUCKET" region = "GCP_STORAGE_REGION" object = "OBJECT_KEY" credentials = "GCP_CREDENTIALS"
sudo base64 -w 0 cee-gcp-nasa-476a1fa485b7.json
sudo composer-cli compose start BLUEPRINT-NAME gce IMAGE_KEY gcp-config.toml
sudo composer-cli compose status
base64 -w 0 "USD{GOOGLE_APPLICATION_CREDENTIALS}"
provider = "gcp" [settings] provider = "gcp" [settings] credentials = "GCP_CREDENTIALS"
[gcp] credentials = " PATH_TO_GCP_ACCOUNT_CREDENTIALS "
virt-install --name kvmtest --memory 2048 --vcpus 2 --cdrom /home/username/Downloads/rhel8.iso,bus=virtio --os-variant=rhel8.0
subscription-manager register --auto-attach
yum install cloud-init systemctl enable --now cloud-init.service
gcloud projects create my-gcp-project3 --name project3
ssh-keygen -t rsa -f ~/.ssh/google_compute_engine
ssh -i ~/.ssh/google_compute_engine <username> @ <instance_external_ip>
gcloud auth login
gsutil mb gs://bucket_name
qemu-img convert -f qcow2 -O raw rhel-8.0-sample.qcow2 disk.raw
tar --format=oldgnu -Sczf disk.raw.tar.gz disk.raw
gsutil cp disk.raw.tar.gz gs://bucket_name
gcloud compute images create my-image-name --source-uri gs://my-bucket-name/disk.raw.tar.gz
gcloud compute instances create myinstance3 --zone=us-central1-a --image test-iso2-image
gcloud compute instances list
ssh -i ~/.ssh/google_compute_engine <user_name>@<instance_external_ip>
subscription-manager register --auto-attach
insights-client register --display-name <display-name-value>
gcloud auth login
gsutil mb gs:// BucketName
gsutil mb gs://rhel-ha-bucket
qemu-img convert -f qcow2 ImageName .qcow2 -O raw disk.raw
tar -Sczf ImageName .tar.gz disk.raw
gsutil cp ImageName .tar.gz gs:// BucketName
gcloud compute images create BaseImageName --source-uri gs:// BucketName / BaseImageName .tar.gz
[admin@localhost ~] USD gcloud compute images create rhel-76-server --source-uri gs://user-rhelha/rhel-server-76.tar.gz Created [https://www.googleapis.com/compute/v1/projects/MyProject/global/images/rhel-server-76]. NAME PROJECT FAMILY DEPRECATED STATUS rhel-76-server rhel-ha-testing-on-gcp READY
gcloud compute instances create BaseInstanceName --can-ip-forward --machine-type n1-standard-2 --image BaseImageName --service-account ServiceAccountEmail
[admin@localhost ~] USD gcloud compute instances create rhel-76-server-base-instance --can-ip-forward --machine-type n1-standard-2 --image rhel-76-server --service-account account@project-name-on-gcp.iam.gserviceaccount.com Created [https://www.googleapis.com/compute/v1/projects/rhel-ha-testing-on-gcp/zones/us-east1-b/instances/rhel-76-server-base-instance]. NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS rhel-76-server-base-instance us-east1-bn1-standard-2 10.10.10.3 192.227.54.211 RUNNING
ssh root@PublicIPaddress
subscription-manager repos --disable= *
subscription-manager repos --enable=rhel-8-server-rpms
yum update -y
metadata.google.internal iburst Google NTP server
rm -f /etc/udev/rules.d/70-persistent-net.rules rm -f /etc/udev/rules.d/75-persistent-net-generator.rules
chkconfig network on
systemctl enable sshd systemctl is-enabled sshd
ln -sf /usr/share/zoneinfo/UTC /etc/localtime
Server times out connections after several minutes of inactivity. Keep alive ssh connections by sending a packet every 7 minutes. ServerAliveInterval 420
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
subscription-manager unregister
export HISTSIZE=0
sync
gcloud compute disks snapshot InstanceName --snapshot-names SnapshotName
gcloud compute images create ConfiguredImageFromSnapshot --source-snapshot SnapshotName
gcloud compute instance-templates create InstanceTemplateName --can-ip-forward --machine-type n1-standard-2 --image ConfiguredImageFromSnapshot --service-account ServiceAccountEmailAddress
[admin@localhost ~] USD gcloud compute instance-templates create rhel-81-instance-template --can-ip-forward --machine-type n1-standard-2 --image rhel-81-gcp-image --service-account account@project-name-on-gcp.iam.gserviceaccount.com Created [https://www.googleapis.com/compute/v1/projects/project-name-on-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
gcloud compute instances create NodeName01 NodeName02 --source-instance-template InstanceTemplateName --zone RegionZone --network= NetworkName --subnet= SubnetName
[admin@localhost ~] USD gcloud compute instances create rhel81-node-01 rhel81-node-02 rhel81-node-03 --source-instance-template rhel-81-instance-template --zone us-west1-b --network=projectVPC --subnet=range0 Created [https://www.googleapis.com/compute/v1/projects/project-name-on-gcp/zones/us-west1-b/instances/rhel81-node-01]. Created [https://www.googleapis.com/compute/v1/projects/project-name-on-gcp/zones/us-west1-b/instances/rhel81-node-02]. Created [https://www.googleapis.com/compute/v1/projects/project-name-on-gcp/zones/us-west1-b/instances/rhel81-node-03]. NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS rhel81-node-01 us-west1-b n1-standard-2 10.10.10.4 192.230.25.81 RUNNING rhel81-node-02 us-west1-b n1-standard-2 10.10.10.5 192.230.81.253 RUNNING rhel81-node-03 us-east1-b n1-standard-2 10.10.10.6 192.230.102.15 RUNNING
subscription-manager repos --disable= *
subscription-manager repos --enable=rhel-8-server-rpms subscription-manager repos --enable=rhel-8-for-x86_64-highavailability-rpms
yum install -y pcs pacemaker fence-agents-gce resource-agents-gcp
yum update -y
passwd hacluster
firewall-cmd --permanent --add-service=high-availability firewall-cmd --reload
systemctl start pcsd.service systemctl enable pcsd.service Created symlink from /etc/systemd/system/multi-user.target.wants/pcsd.service to /usr/lib/systemd/system/pcsd.service.
systemctl status pcsd.service pcsd.service - PCS GUI and remote configuration interface Loaded: loaded (/usr/lib/systemd/system/pcsd.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2018-06-25 19:21:42 UTC; 15s ago Docs: man:pcsd(8) man:pcs(8) Main PID: 5901 (pcsd) CGroup: /system.slice/pcsd.service └─5901 /usr/bin/ruby /usr/lib/pcsd/pcsd > /dev/null &
pcs host auth hostname1 hostname2 hostname3 Username: hacluster Password: hostname1 : Authorized hostname2 : Authorized hostname3 : Authorized
pcs cluster setup cluster-name hostname1 hostname2 hostname3
pcs cluster enable --all
pcs cluster start --all
fence_gce --zone us-west1-b --project=rhel-ha-on-gcp -o list
fence_gce --zone us-west1-b --project=rhel-ha-testing-on-gcp -o list 4435801234567893181,InstanceName-3 4081901234567896811,InstanceName-1 7173601234567893341,InstanceName-2
pcs stonith create FenceDeviceName fence_gce zone= Region-Zone project= MyProject
pcs status
pcs status Cluster name: gcp-cluster Stack: corosync Current DC: rhel81-node-02 (version 1.1.18-11.el7_5.3-2b07d5c5a9) - partition with quorum Last updated: Fri Jul 27 12:53:25 2018 Last change: Fri Jul 27 12:51:43 2018 by root via cibadmin on rhel81-node-01 3 nodes configured 3 resources configured Online: [ rhel81-node-01 rhel81-node-02 rhel81-node-03 ] Full list of resources: us-west1-b-fence (stonith:fence_gce): Started rhel81-node-01 Daemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled
gcloud-ra init
pcs resource describe gcp-vpc-move-vip
pcs resource create aliasip gcp-vpc-move-vip alias_ip= UnusedIPaddress/CIDRblock
pcs resource create aliasip gcp-vpc-move-vip alias_ip=10.10.10.200/32
pcs resource create vip IPaddr2 nic= interface ip= AliasIPaddress cidr_netmask=32
pcs resource create vip IPaddr2 nic=eth0 ip=10.10.10.200 cidr_netmask=32
pcs resource group add vipgrp aliasip vip
pcs status
pcs resource move vip Node
pcs resource move vip rhel81-node-03
pcs status
gcloud-ra compute networks subnets update SubnetName --region RegionName --add-secondary-ranges SecondarySubnetName = SecondarySubnetRange
gcloud-ra compute networks subnets update range0 --region us-west1 --add-secondary-ranges range1=10.10.20.0/24
pcs resource create aliasip gcp-vpc-move-vip alias_ip= UnusedIPaddress/CIDRblock
pcs resource create aliasip gcp-vpc-move-vip alias_ip=10.10.20.200/32
pcs resource create vip IPaddr2 nic= interface ip= AliasIPaddress cidr_netmask=32
pcs resource create vip IPaddr2 nic=eth0 ip=10.10.20.200 cidr_netmask=32
pcs resource group add vipgrp aliasip vip
pcs status
pcs resource move vip Node
pcs resource move vip rhel81-node-03
pcs status