Closed ryanj closed 2 weeks ago
^ these notes should be moved to a markdown doc somewhere in the repo
@ryanj I was able to keep the same hostname while recreating the new image like this:
hostnamectl set-hostname --static crc-gh9wd-master-0
hostnamectl set-hostname --transient crc-gh9wd-master-0
@ryanj actually the hostname then mismatches with kubelet:
[root@crc-gh9wd-master-0 ~]# oc get nodes
NAME STATUS ROLES AGE VERSION
crc-5nvrm-master-0 NotReady master,worker 11d v1.23.5+3afdacb
About CRC VM image extraction
step I think you don't need the vpn to download the bundle because after crc release it is publicly available and if you want some different bundle then only use vpn and get the linux bundle from internal server http://cdk-builds.usersys.redhat.com/builds/crc/bundles/openshift/ location.
Downloading bundle for a latest crc release should be simply.
$ openshiftVersion=$(curl -sL https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/release-info.json | jq -r .version.openshiftVersion)
$ curl -L -O https://mirror.openshift.com/pub/openshift-v4/clients/crc/bundles/openshift/"${openshiftVersion}"/crc_libvirt_"${openshiftVersion}"_amd64.crcbundle
Ping me for access to the final build doc
Document the image build process (https://github.com/openshift-instruqt/instruqt/issues/88)
CRC tarball -> crc binary -> crc.qcow2 -> disk.raw -> crc.tar.gz -> GCP Image (build) -> GCP Image (GUID) -> GCP instance (launched via instruqt) -> GCP instance (READY)
Solution Outline:
GCP setup
gcloud auth login
gcloud config set project rhd-devx-instruqt
CRC VM image extraction
Image Extraction workflow (tested on Fedora35):
tar xvf ~/Downloads/crc-linux-amd64.tar.xz
$PATH
-accessible folder for your local binaries:mkdir -p ~/.local/bin
export CRC_RELEASE=2.10.1
and OS_RELEASEexport OPENSHIFT_RELEASE=4.11.7
mv ~/Downloads/crc-linux-${CRC_RELEASE}-amd64/crc ~/.local/bin
crc setup
to download the latest CRC qcow2 VM image to your local machinecd ~/.crc/cache/crc_libvirt_${OPENSHIFT_RELEASE}_amd64/ && ls -alh
qemu-img convert -O raw ~/.crc/cache/crc_libvirt_${OPENSHIFT_RELEASE}_amd64/crc.qcow2 ~/.crc/cache/crc_libvirt_${OPENSHIFT_RELEASE}_amd64/disk.raw
tar cvf crc.tar disk.raw
gzip crc.tar
disk.raw
:tar tfz crc.tar.gz
Import the raw CRC disk image to GCP
Try listing images from the command line. This step should give you an opportunity to enable the Compute API for your project:
gcloud compute images list --no-standard-images | grep openshift
.export CRC_DASH_RELEASE=2-10-1
export OPENSHIFT_DASH_RELEASE=4-11-7
Use Google Cloud Storage to create a new storage bucket for the raw image:
gsutil mb -l europe-west1 gs://openshift-${OPENSHIFT_DASH_RELEASE}
Upload the raw image to the new cloud storage bucket
gsutil cp ~/.crc/cache/crc_libvirt_${OPENSHIFT_RELEASE}_amd64/crc.tar.gz gs://openshift-${OPENSHIFT_DASH_RELEASE}
Review what you've uploaded to the bucket:
gcloud alpha storage ls gs://openshift-${OPENSHIFT_DASH_RELEASE}
After the upload has completed, create a new Image in region
europe-west1
by selecting it from the bucketgs://openshift-${OPENSHIFT_DASH_RELEASE}
:gcloud compute images create --storage-location europe-west1 openshift-${OPENSHIFT_DASH_RELEASE}-disk --source-uri gs://openshift-${OPENSHIFT_DASH_RELEASE}/crc.tar.gz
Confirm that the new image is available in GCP:
gcloud compute images list --no-standard-images | grep openshift
GCP Image Build
Establish a build script and automation for converting the image ending with "-disk" into a pre-booted image with a name that ends with "-GUID" (use GCP cloud build, packer, or ssh?). The "-GUID" version will be booted by instruqt
gcloud compute instances create openshift-${OPENSHIFT_DASH_RELEASE}-build --image openshift-${OPENSHIFT_DASH_RELEASE}-disk --zone=europe-west1-c --machine-type n1-standard-8
ssh -i ~/.crc/cache/crc_libvirt_${OPENSHIFT_RELEASE}_amd64/id_ecdsa_crc core@EXTERNAL_IP
sudo su -
then run the following script: https://github.com/openshift-labs/learn-instruqt/blob/main/scripts/build/setup.shsystemctl reset-failed
exit
openshift-config
namespace: https://github.com/openshift-labs/learn-instruqt/blob/main/scripts/pullsecret.jsonsudo chown core.core /var/lib/kubelet/config.json
export KUBECONFIG=/opt/kubeconfig
oc delete secret pull-secret -n openshift-config && oc create secret generic pull-secret --from-file=.dockerconfigjson=/var/lib/kubelet/config.json --type=kubernetes.io/dockerconfigjson -n openshift-config
admin
,developer
, anduser1
accounts: https://github.com/openshift-instruqt/instruqt/pull/117/files#diff-e438bfd9dad2f72ff1626b329d6d466d2afc779b8209f3866498f64fd1742dc0R42-R68history -c
sudo shutdown -h now
gcloud compute images create openshift-${OPENSHIFT_DASH_RELEASE}-GUID --project=rhd-devx-instruqt --source-disk=openshift-${OPENSHIFT_DASH_RELEASE}-build --source-disk-zone=europe-west1-c --storage-location=europe-west1
Optimization goals
Client Image Build
Image startup optimizations