Skip to content

Instantly share code, notes, and snippets.

@goffinet
Forked from pottava/crc-on-google-cloud.md
Created October 2, 2022 13:06
Show Gist options
  • Select an option

  • Save goffinet/c33a432516fea9746085f82436f9b278 to your computer and use it in GitHub Desktop.

Select an option

Save goffinet/c33a432516fea9746085f82436f9b278 to your computer and use it in GitHub Desktop.
CodeReady Containers (crc)

VM 上での crc 起動

1. VM 作成

vm_name=
gcloud compute instances create \
    "${vm_name}" --zone asia-northeast1-c \
    --image-project=ubuntu-os-cloud --image-family=ubuntu-2004-lts \
    --machine-type "n2-custom-8-12288" --boot-disk-size 50G --boot-disk-type pd-standard \
    --enable-nested-virtualization --metadata=enable-oslogin=TRUE
gcloud compute ssh "${vm_name}" --zone asia-northeast1-c

OS ログインを使わない場合

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

2. crc インストール

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
cd crc-linux-1.28.0-amd64/
./crc config set network-mode user
./crc setup
exit

3. VM リセット

gcloud compute reset "${vm_name}" --zone asia-northeast1-c
gcloud compute ssh "${vm_name}" --zone asia-northeast1-c

4. crc 起動

cd crc-linux-1.28.0-amd64/
./crc daemon

別のターミナルを起動して

cd crc-linux-1.28.0-amd64/
./crc start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment