vm_name=
gcloud compute instances create \
"${vm_name}" --zone asia-northeast1-c \
--image-project=ubuntu-os-cloud --image-family=ubuntu-2004-lts \
--machine-type "n1-custom-14-36864" --boot-disk-size 300G --boot-disk-type pd-standard \
--enable-nested-virtualization --metadata=enable-oslogin=TRUE
gcloud compute ssh "${vm_name}" --zone asia-northeast1-c
without OS login,
ssh-keygen -t ed25519 -N "" -f "id_rsa_crc"
sed "s/ssh-ed25519/$(whoami):ssh-ed25519/" "id_rsa_crc.pub" > ssh-metadata
gcloud compute instances add-metadata "${vm_name}" \
--zone asia-northeast1-c --metadata-from-file ssh-keys=ssh-metadata
gcloud compute ssh "${vm_name}" --ssh-key-file="id_rsa_crc" --tunnel-through-iap
sudo apt-get update
sudo apt install -y qemu-kvm libvirt-daemon libvirt-daemon-system network-manager
wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/clients/crc/latest/crc-linux-amd64.tar.xz
tar -xvf crc-linux-amd64.tar.xz
sudo mv crc-linux-*/crc /usr/local/bin/
crc config set cpus 10
crc config set memory 30517
crc config set disk-size 200
crc config set network-mode user
crc config set consent-telemetry no
crc config view
crc cleanup
crc setup
exit
gcloud compute instances reset "${vm_name}" --zone asia-northeast1-c
gcloud compute ssh "${vm_name}" --zone asia-northeast1-c
You have to prepare a pull secret
on https://cloud.redhat.com/openshift/create/local in advance.
crc setup
crc daemon &
crc start
Open the /etc/hosts, and add the following 3 lines. (@see https://code-ready.github.io/crc/#dns-configuration-linux_gsg)
34.146.76.136 api.crc.testing
34.146.76.136 oauth-openshift.apps-crc.testing
34.146.76.136 console-openshift-console.apps-crc.testing
Login as an administrator, then request the resources.
eval $(crc oc-env)
oc login -u kubeadmin https://api.crc.testing:6443
oc get co
oc get po --all-namespaces | wc -l
Try kubectl as well.
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
export KUBECONFIG=$HOME/.crc/machines/crc/kubeconfig
kubectl get po --all-namespaces | wc -l
@see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning