-
-
Save goffinet/c33a432516fea9746085f82436f9b278 to your computer and use it in GitHub Desktop.
Revisions
-
pottava revised this gist
Aug 4, 2021 . 1 changed file with 0 additions and 101 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -91,104 +91,3 @@ kubectl get po --all-namespaces | wc -l ## 6. Make a StorageClass @see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning -
pottava revised this gist
Aug 4, 2021 . 1 changed file with 13 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Setup a CRC instance on Google Cloud ## 1. Create a VM ```bash vm_name= @@ -12,7 +12,7 @@ gcloud compute instances create \ gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ``` without OS login, ```bash ssh-keygen -t ed25519 -N "" -f "id_rsa_crc" @@ -22,7 +22,7 @@ gcloud compute instances add-metadata "${vm_name}" \ gcloud compute ssh "${vm_name}" --ssh-key-file="id_rsa_crc" --tunnel-through-iap ``` ## 2. Install CRC ```bash sudo apt-get update @@ -41,26 +41,26 @@ crc setup exit ``` ## 3. Reset the VM ```bash gcloud compute instances reset "${vm_name}" --zone asia-northeast1-c gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ``` ## 4. Start the CRC server You have to prepare a `pull secret` on https://cloud.redhat.com/openshift/create/local in advance. ```bash crc setup crc daemon & crc start ``` ## 5. Connect to the server Open the /etc/hosts, and add the following 3 lines. (@see https://code-ready.github.io/crc/#dns-configuration-linux_gsg) ```text @@ -69,7 +69,7 @@ crc start 34.146.76.136 console-openshift-console.apps-crc.testing ``` Login as an administrator, then request the resources. ```bash eval $(crc oc-env) @@ -78,7 +78,7 @@ oc get co oc get po --all-namespaces | wc -l ``` Try kubectl as well. ```bash curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" @@ -88,10 +88,9 @@ export KUBECONFIG=$HOME/.crc/machines/crc/kubeconfig kubectl get po --all-namespaces | wc -l ``` ## 6. Make a StorageClass @see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning ```bash oc new-project local-path-storage -
pottava revised this gist
Jul 28, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,10 +30,11 @@ sudo apt install -y qemu-kvm libvirt-daemon libvirt-daemon-system network-manage 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 -
pottava revised this gist
Jul 28, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,8 +32,8 @@ tar -xvf crc-linux-amd64.tar.xz sudo mv crc-linux-*/crc /usr/local/bin/ crc config set network-mode user crc config set cpus 10 crc config set memory 30517 crc config set disk-size 200 crc config view crc cleanup crc setup -
pottava revised this gist
Jul 28, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,6 +33,8 @@ sudo mv crc-linux-*/crc /usr/local/bin/ crc config set network-mode user crc config set cpus 10 crc config set memory 28610 crc config set disk-size 250 crc config view crc cleanup crc setup exit -
pottava revised this gist
Jul 28, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ 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 ``` @@ -31,8 +31,8 @@ wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/ tar -xvf crc-linux-amd64.tar.xz sudo mv crc-linux-*/crc /usr/local/bin/ crc config set network-mode user crc config set cpus 10 crc config set memory 28610 crc cleanup crc setup exit -
pottava revised this gist
Jul 28, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ 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-30720" --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 ``` @@ -31,6 +31,8 @@ wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/ tar -xvf crc-linux-amd64.tar.xz sudo mv crc-linux-*/crc /usr/local/bin/ crc config set network-mode user crc config set cpus 12 crc config set memory 22888 crc cleanup crc setup exit -
pottava revised this gist
Jul 28, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ 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-standard-16" --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 ``` -
pottava revised this gist
Jul 26, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,6 +31,7 @@ wget https://developers.redhat.com/content-gateway/rest/mirror/pub/openshift-v4/ tar -xvf crc-linux-amd64.tar.xz sudo mv crc-linux-*/crc /usr/local/bin/ crc config set network-mode user crc cleanup crc setup exit ``` -
pottava revised this gist
Jul 26, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ 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-12-30720" --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 ``` -
pottava revised this gist
Jul 26, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ 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-12-30720" --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 ``` -
pottava revised this gist
Jul 16, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,6 +44,8 @@ gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ## 4. crc 起動 https://cloud.redhat.com/openshift/create/local で予め取得しておいた Pull secret を渡し、CRC を起動します。 ```bash crc setup crc daemon & -
pottava revised this gist
Jul 15, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,6 +45,7 @@ gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ## 4. crc 起動 ```bash crc setup crc daemon & crc start ``` -
pottava revised this gist
Jul 15, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,7 +29,7 @@ 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 network-mode user crc setup exit -
pottava revised this gist
Jul 12, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ 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-20480" --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 ``` -
pottava revised this gist
Jun 30, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,7 +51,7 @@ crc start ## 5. crc 接続 /etc/hosts に以下を追加する (@see https://code-ready.github.io/crc/#dns-configuration-linux_gsg) ```text @@ -81,7 +81,7 @@ kubectl get po --all-namespaces | wc -l ## 6. StorageClass の作成 ローカル PV へのダイナミックプロビジョナを用意します (@see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning) ```bash -
pottava revised this gist
Jun 30, 2021 . 1 changed file with 106 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,4 +77,110 @@ chmod +x kubectl sudo mv kubectl /usr/local/bin/ export KUBECONFIG=$HOME/.crc/machines/crc/kubeconfig kubectl get po --all-namespaces | wc -l ``` ## 6. StorageClass の作成 ローカル PV へのダイナミックプロビジョナを用意します。 (@see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning) ```bash oc new-project local-path-storage oc create serviceaccount local-path-provisioner -n local-path-storage oc adm policy add-scc-to-user hostaccess -z local-path-provisioner -n local-path-storage cat <<EOF | oc apply -f - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: local-path-provisioner-role rules: - apiGroups: [""] resources: ["nodes", "persistentvolumeclaims"] verbs: ["get", "list", "watch"] - apiGroups: [""] resources: ["endpoints", "persistentvolumes", "pods"] verbs: ["*"] - apiGroups: [""] resources: ["events"] verbs: ["create", "patch"] - apiGroups: ["storage.k8s.io"] resources: ["storageclasses"] verbs: ["get", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: local-path-provisioner-bind roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: local-path-provisioner-role subjects: - kind: ServiceAccount name: local-path-provisioner namespace: local-path-storage --- apiVersion: apps/v1 kind: Deployment metadata: name: local-path-provisioner namespace: local-path-storage spec: replicas: 1 selector: matchLabels: app: local-path-provisioner template: metadata: labels: app: local-path-provisioner spec: serviceAccountName: local-path-provisioner containers: - name: local-path-provisioner image: rancher/local-path-provisioner:v0.0.12 imagePullPolicy: IfNotPresent command: - local-path-provisioner - --debug - start - --config - /etc/config/config.json volumeMounts: - name: config-volume mountPath: /etc/config/ env: - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace volumes: - name: config-volume configMap: name: local-path-config --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: local-path provisioner: rancher.io/local-path volumeBindingMode: WaitForFirstConsumer reclaimPolicy: Delete --- kind: ConfigMap apiVersion: v1 metadata: name: local-path-config namespace: local-path-storage data: config.json: |- { "nodePathMap":[ { "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", "paths":["/mnt/pv-data"] } ] } EOF ``` -
pottava revised this gist
Jun 30, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,7 @@ exit ## 3. VM リセット ```bash gcloud compute instances reset "${vm_name}" --zone asia-northeast1-c gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ``` -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,8 +29,7 @@ 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-1.28.0-amd64/crc /usr/local/bin/ crc config set network-mode user crc setup exit @@ -46,8 +45,6 @@ gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ## 4. crc 起動 ```bash crc daemon & crc start ``` @@ -69,14 +66,15 @@ crc start eval $(crc oc-env) oc login -u kubeadmin https://api.crc.testing:6443 oc get co oc get po --all-namespaces | wc -l ``` kubectl でも接続を確認 ```bash 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 ``` -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 1 addition and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,16 +45,10 @@ gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ## 4. crc 起動 ```bash cd crc-linux-1.28.0-amd64/ export PATH=$PATH:$(pwd) crc daemon & crc start ``` -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,5 +83,6 @@ kubectl でも接続を確認 ```bash curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" chmod +x kubectl export KUBECONFIG=$HOME/.crc/machines/crc/kubeconfig kubectl get po --all-namespaces | wc -l ``` -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,4 +75,13 @@ crc start eval $(crc oc-env) oc login -u kubeadmin https://api.crc.testing:6443 oc get co oc get po --all-namespaces ``` kubectl でも接続を確認 ```bash curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" chmod +x kubectl kubectl get po --all-namespaces | wc -l ``` -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,8 +30,9 @@ sudo apt install -y qemu-kvm libvirt-daemon libvirt-daemon-system network-manage 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/ export PATH=$PATH:$(pwd) crc config set network-mode user crc setup exit ``` @@ -53,7 +54,8 @@ cd crc-linux-1.28.0-amd64/ ```bash cd crc-linux-1.28.0-amd64/ export PATH=$PATH:$(pwd) crc start ``` ## 5. crc 接続 -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -54,4 +54,23 @@ cd crc-linux-1.28.0-amd64/ ```bash cd crc-linux-1.28.0-amd64/ ./crc start ``` ## 5. crc 接続 /etc/hosts に以下を追加する (@see https://code-ready.github.io/crc/#dns-configuration-linux_gsg) ```text 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 ``` 管理者権限でログインし、リソースを表示 ```bash eval $(crc oc-env) oc login -u kubeadmin https://api.crc.testing:6443 oc get co ``` -
pottava renamed this gist
Jun 29, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
pottava revised this gist
Jun 29, 2021 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,11 +45,13 @@ gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ## 4. crc 起動 ```bash cd crc-linux-1.28.0-amd64/ ./crc daemon ``` 別のターミナルを起動して ```bash cd crc-linux-1.28.0-amd64/ ./crc start ``` -
pottava created this gist
Jun 29, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ # VM 上での crc 起動 ## 1. VM 作成 ```bash 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 ログインを使わない場合 ```bash 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 インストール ```bash 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 リセット ```bash gcloud compute reset "${vm_name}" --zone asia-northeast1-c gcloud compute ssh "${vm_name}" --zone asia-northeast1-c ``` ## 4. crc 起動 ```bash cd crc-linux-1.28.0-amd64/ && ./crc daemon ``` 別のターミナルを起動して ```bash cd crc-linux-1.28.0-amd64/ && ./crc start ```