Cyber Deals - Get up to 65% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

OpenShift Installation on GCP with Nested Vrtualization

Warning: This is NOT tested multiple times; refere by your own risk

gcloud compute disks create crc-disk –image-project ubuntu-os-cloud –image-family ubuntu-1804-lts –zone us-central1-a gcloud compute images create crc-v4-image –source-disk crc-disk –source-disk-zone us-central1-a –licenses “https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"

#use this image to create a vm instance

use direct nested virtualization while createing VM

https://cloud.google.com/compute/docs/instances/nested-virtualization/enabling

Tip:

  • get the gcloud command from GCP console and add nested virtualization option at the end.
  • find the location availale with supported CPU options
$ gcloud compute instances create gcp-crc-openshift \
  --project=ak-hosting \
  --zone=us-central1-a \
  --machine-type=e2-standard-4 \
  --network-interface=network-tier=PREMIUM,subnet=default \
  --maintenance-policy=MIGRATE \
  --service-account=[email protected] \
  --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append \
  --tags=http-server,https-server \
  --create-disk=auto-delete=yes,boot=yes,device-name=gcp-crc-openshift,image=projects/centos-cloud/global/images/centos-8-v20211214,mode=rw,size=50,type=projects/ak-hosting/zones/us-central1-a/diskTypes/pd-balanced \
  --no-shielded-secure-boot \
  --shielded-vtpm \
  --shielded-integrity-monitoring \
  --reservation-affinity=any \
  --enable-nested-virtualization

sudo apt-get update sudo apt-get install –assume-yes qemu-kvm libvirt-daemon libvirt-daemon-system dnsmasq

sudo usermod -a -G libvirt $(whoami) sudo usermod -a -G libvirt-qemu $(whoami) sudo usermod -a -G libvirt-dnsmasq $(whoami)

sudo reboot

cat « EOF | sudo tee /etc/systemd/resolved.conf > /dev/null [Resolve] DNS=127.0.0.2 Domains=apps-crc.testing crc.testing EOF

sudo sed -i ’s/#listen-address=/listen-address=127.0.0.2/g’ /etc/dnsmasq.conf

cat « EOF | sudo tee /etc/default/dnsmasq > /dev/null DOMAIN_SUFFIX=`` ENABLED=1 CONFIG_DIR=/etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new IGNORE_RESOLVCONF=yes EOF

cat « EOF | sudo tee /etc/dnsmasq.d/crc.conf > /dev/null address=/crc.testing/192.168.130.11 address=/apps-crc.testing/192.168.130.11 server=/#/8.8.8.8 EOF

sudo systemctl restart systemd-resolved sudo systemctl restart dnsmasq

dig foo.apps-crc.testing | echo $(grep 192.168.130.11) dig api.crc.testing | echo $(grep 192.168.130.11)

curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz && tar -Jxvf crc-linux-amd64.tar.xz && mkdir -p /bin && export PATH=$PATH:/bin && mv crc-linux*/crc ~/bin/ && rm -rf crc*

crc config set skip-check-network-manager-installed true crc config set skip-check-network-manager-config true crc config set skip-check-network-manager-running true crc config set skip-check-crc-dnsmasq-file true

crc setup

Download crc pull secret from https://cloud.redhat.com/openshift/install/crc/installer-provisioned and keep it in ~/.crc-pull-secret

nohup crc start -m 20480 -p ~/.crc-pull-secret &

References:

https://github.com/code-ready/crc/issues/549#issuecomment-529379181 https://github.com/code-ready/crc/issues/549#issuecomment-573676404


#on the gcp ubuntu - nexted virtualization enabled vm, run the following

wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb sudo apt update sudo dpkg –install chrome-remote-desktop_current_amd64.deb sudo apt install –assume-yes –fix-broken

#install xfce sudo DEBIAN_FRONTEND=noninteractive apt install –assume-yes xfce4 desktop-base sudo bash -c ’echo “exec /etc/X11/Xsession /usr/bin/xfce4-session” > /etc/chrome-remote-desktop-session' sudo apt install –assume-yes xscreensaver

#install chrome wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb sudo dpkg –install google-chrome-stable_current_amd64.deb sudo apt install –assume-yes –fix-broken

Go to https://remotedesktop.google.com/headless and follow the steps to enable remote access

Finally start using remote access from https://remotedesktop.google.com/access

https://github.com/bbalakriz/crc-ubuntu

Disclaimer: Views expressed in articles are those of the respective authors and do not necessarily reflect the views of their employers or this site. While we aim for accuracy, please verify information before relying on it, and let us know if you spot an error.
Share:

Related Posts

Openshift

OCP Origin 3.x Installation - on GCP

Master Server Configuration Step 1 : Update system Step 2 : Install Required Packages Step 3 : Clone the package from github Step 4: Configure your …

Openshift

VirtualBox Notes

1. VirtualBox Guest Addtion on CLI 2. Optimize VirtualBox VM Disk Space 3. Troubleshooing VirtualBox VM 3.1. Unable to mount Shared folders in CLI 1. …

Openshift

OpenShift Installation Methods - Examples

Installing an OKD 4.x Cluster Install OpenShift 4.x Method I - Setup an OpenShift All-In-One Install required packages Disable Firewall Installing …

Openshift

OpenShift Installation Baremetal on AWS

INPG - DO NOT FOLLOW BLINDLY! Other notes: OpenShift - Tools, Learning Guides and References OpenShift and Service Mesh OpenShift Installation Methods …

Openshift

OpenShift Local (Formerly CodeReady Containers - CRC)

Installing CodeReady Containers Download CRC Package Required software packages Enable sudo for user Setup Cluster Access your Cluster Enable cluster …