Infrastructure at your Service

Nicolas Penot

Red Hat 8 Server in 9 minutes into the Google Cloud

Do you have 9 minutes to learn how to quick start with the Google Cloud? Here is a simple copy/past procedure to successfully deploy a Red Hat 8 compute server into the Cloud.

Installation of the Google command client

Download first the client and uncompress it:

$ curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-255.0.0-linux-x86_64.tar.gz
$ tar zxvf google-cloud-sdk-255.0.0-linux-x86_64.tar.gz

Optionally configure the PATH for your comfort:
$ ./google-cloud-sdk/install.sh

That command will connect your local environment with your cloud. Just follow the provided instructions:
$ gcloud init --console-only

Now you’re connected and ready to go 🙂

Creation of your compute node Red Hat 8

First of all, here a simple way to get help from your local environment:
$ gcloud compute -h
Usage: gcloud compute [optional flags] <group | command>
group may be accelerator-types | addresses | backend-buckets |
backend-services | commitments | diagnose |
disk-types | disks | firewall-rules |
forwarding-rules | health-checks | http-health-checks |
https-health-checks | images | instance-groups |
instance-templates | instances | interconnects |
machine-types | network-endpoint-groups | networks |
operations | os-login | project-info | regions |
reservations | resource-policies | routers | routes |
security-policies | shared-vpc | snapshots |
sole-tenancy | ssl-certificates | ssl-policies |
target-http-proxies | target-https-proxies |
target-instances | target-pools | target-ssl-proxies |
target-tcp-proxies | target-vpn-gateways | tpus |
url-maps | vpn-tunnels | zones
command may be config-ssh | connect-to-serial-port | copy-files |
reset-windows-password | scp | sign-url | ssh |
start-iap-tunnel

You list he available images and search for the Red Hat 8 (or whichever) to create your compute server:
$ gcloud compute images list | grep rhel-8
rhel-8-v20190618 rhel-cloud rhel-8 READY

Then, you may want your compute server be located close to you. I’ll chose Europe and specially the Frankfurt area:

$ gcloud compute zones list | grep europe
europe-west4-a europe-west4 UP
europe-west4-b europe-west4 UP
europe-west4-c europe-west4 UP
europe-west1-b europe-west1 UP
europe-west1-d europe-west1 UP
europe-west1-c europe-west1 UP
europe-west3-c europe-west3 UP ----> germany frankfurt, zone A
europe-west3-a europe-west3 UP ----> germany frankfurt, zone B
europe-west3-b europe-west3 UP ----> germany frankfurt, zone C
europe-west2-c europe-west2 UP
europe-west2-b europe-west2 UP
europe-west2-a europe-west2 UP
europe-north1-a europe-north1 UP
europe-north1-b europe-north1 UP
europe-north1-c europe-north1 UP
europe-west6-a europe-west6 UP
europe-west6-b europe-west6 UP
europe-west6-c europe-west6 UP

Now, you’re ready to create your compute server with few CPU core and memory:
$ gcloud compute instances create openshift-master --zone europe-west3-a --custom-cpu=2 --custom-memory=2G --image-project=rhel-cloud --image-family=rhel-8
Created [https://www.googleapis.com/compute/v1/projects/vivid-env-242712/zones/europe-west3-a/instances/openshift-master].
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
openshift-master europe-west3-a custom (2 vCPU, 2.00 GiB) 10.156.0.3 35.234.117.157 RUNNING

After few seconds, the compute server is immediately reachable:
$ ping -c 1 35.234.117.157
PING 35.234.117.157 (35.234.117.157) 56(84) bytes of data.
64 bytes from 35.234.117.157: icmp_seq=1 ttl=59 time=55.4 ms
--- 35.234.117.157 ping statistics ---
.
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 55.453/55.453/55.453/0.000 ms

Now you can configure you local ssh environment for your comfort and password less authentication:
$ gcloud compute config-ssh
You should now be able to use ssh/scp with your instances.
For example, try running:
.
$ ssh openshift-master.europe-west3-a.vivid-env-242712

You connect to the instance and verify your OS release:
$ ssh openshift-master.europe-west3-a.vivid-env-242712
The authenticity of host 'compute.6016769543430629535 (35.234.117.157)' can't be established.
ECDSA key fingerprint is SHA256:aiHQl7nOQsqLNEmZ2yBxe1Ry8zlkBA8fLe0pKJuEm0s.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'compute.6016769543430629535' (ECDSA) to the list of known hosts.
[[email protected] ~]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.0 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.0"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.0 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.0:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

Cleaning

Don’t forget to destroy your resource once you finished your work, otherwise the monthly billing will teach it to you:
$ gcloud compute instances list
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
openshift-master europe-west3-a custom (2 vCPU, 2.00 GiB) 10.156.0.3 35.234.117.157 RUNNING

$ gcloud compute instances delete openshift-master --zone europe-west3-a --quiet
Deleted [https://www.googleapis.com/compute/v1/projects/vivid-env-242712/zones/europe-west3-a/instances/openshift-master].

Conclusion

I find quit simple to deploy component into the Google cloud. Do you? Of course that was a simple infrastructure with one server. You may need to deploy more sustainable components and interconnect them for your more complex infrastructure. Are you about to start new deployment into the Cloud?

I hope this helps and please don’t hesitate to contact us or comment below should you need more detail.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Nicolas Penot
Nicolas Penot

Consultant