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.

Revisions

  1. @pottava pottava revised this gist Aug 4, 2021. 1 changed file with 0 additions and 101 deletions.
    101 changes: 0 additions & 101 deletions crc-on-google-cloud.md
    Original 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

    ```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
    ```
  2. @pottava pottava revised this gist Aug 4, 2021. 1 changed file with 13 additions and 14 deletions.
    27 changes: 13 additions & 14 deletions crc-on-google-cloud.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # VM 上での crc 起動
    # Setup a CRC instance on Google Cloud

    ## 1. VM 作成
    ## 1. Create a VM

    ```bash
    vm_name=
    @@ -12,7 +12,7 @@ gcloud compute instances create \
    gcloud compute ssh "${vm_name}" --zone asia-northeast1-c
    ```

    OS ログインを使わない場合
    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. crc インストール
    ## 2. Install CRC

    ```bash
    sudo apt-get update
    @@ -41,26 +41,26 @@ crc setup
    exit
    ```

    ## 3. VM リセット
    ## 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. crc 起動
    ## 4. Start the CRC server

    https://cloud.redhat.com/openshift/create/local で予め取得しておいた Pull secret を渡し、CRC を起動します。
    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. crc 接続
    ## 5. Connect to the server

    /etc/hosts に以下を追加する
    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
    ```

    kubectl でも接続を確認
    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. StorageClass の作成
    ## 6. Make a StorageClass

    ローカル PV へのダイナミックプロビジョナを用意します
    (@see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning)
    @see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning

    ```bash
    oc new-project local-path-storage
  3. @pottava pottava revised this gist Jul 28, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion crc-on-google-cloud.md
    Original 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 network-mode user
    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
  4. @pottava pottava revised this gist Jul 28, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions crc-on-google-cloud.md
    Original 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 28610
    crc config set disk-size 250
    crc config set memory 30517
    crc config set disk-size 200
    crc config view
    crc cleanup
    crc setup
  5. @pottava pottava revised this gist Jul 28, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions crc-on-google-cloud.md
    Original 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
  6. @pottava pottava revised this gist Jul 28, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions crc-on-google-cloud.md
    Original 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 \
    --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 12
    crc config set memory 22888
    crc config set cpus 10
    crc config set memory 28610
    crc cleanup
    crc setup
    exit
  7. @pottava pottava revised this gist Jul 28, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion crc-on-google-cloud.md
    Original 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 \
    --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
  8. @pottava pottava revised this gist Jul 28, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion crc-on-google-cloud.md
    Original 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 \
    --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
    ```
  9. @pottava pottava revised this gist Jul 26, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions crc-on-google-cloud.md
    Original 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
    ```
  10. @pottava pottava revised this gist Jul 26, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion crc-on-google-cloud.md
    Original 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 \
    --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
    ```
  11. @pottava pottava revised this gist Jul 26, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion crc-on-google-cloud.md
    Original 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 \
    --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
    ```
  12. @pottava pottava revised this gist Jul 16, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions crc-on-google-cloud.md
    Original 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 &
  13. @pottava pottava revised this gist Jul 15, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions crc-on-google-cloud.md
    Original 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
    ```
  14. @pottava pottava revised this gist Jul 15, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion crc-on-google-cloud.md
    Original 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-1.28.0-amd64/crc /usr/local/bin/
    sudo mv crc-linux-*/crc /usr/local/bin/
    crc config set network-mode user
    crc setup
    exit
  15. @pottava pottava revised this gist Jul 12, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion crc-on-google-cloud.md
    Original 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-12288" --boot-disk-size 50G --boot-disk-type pd-standard \
    --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
    ```
  16. @pottava pottava revised this gist Jun 30, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions crc-on-google-cloud.md
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,7 @@ crc start

    ## 5. crc 接続

    /etc/hosts に以下を追加する
    /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 へのダイナミックプロビジョナを用意します
    ローカル PV へのダイナミックプロビジョナを用意します
    (@see https://github.com/code-ready/crc/wiki/Dynamic-volume-provisioning)

    ```bash
  17. @pottava pottava revised this gist Jun 30, 2021. 1 changed file with 106 additions and 0 deletions.
    106 changes: 106 additions & 0 deletions crc-on-google-cloud.md
    Original 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
    ```
  18. @pottava pottava revised this gist Jun 30, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion crc-on-google-cloud.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ exit
    ## 3. VM リセット

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

  19. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions crc-on-google-cloud.md
    Original 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
    cd crc-linux-1.28.0-amd64/
    export PATH=$PATH:$(pwd)
    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
    cd crc-linux-1.28.0-amd64/
    export PATH=$PATH:$(pwd)
    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
    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
    ```
  20. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 1 addition and 7 deletions.
    8 changes: 1 addition & 7 deletions crc-on-google-cloud.md
    Original 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/
    ./crc daemon
    ```

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

    ```bash
    cd crc-linux-1.28.0-amd64/
    export PATH=$PATH:$(pwd)
    crc daemon &
    crc start
    ```

  21. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions crc-on-google-cloud.md
    Original 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
    ```
  22. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions crc-on-google-cloud.md
    Original 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
    ```
  23. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions crc-on-google-cloud.md
    Original 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/
    ./crc config set network-mode user
    ./crc setup
    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/
    ./crc start
    export PATH=$PATH:$(pwd)
    crc start
    ```

    ## 5. crc 接続
  24. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions crc-on-google-cloud.md
    Original 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
    ```
  25. @pottava pottava renamed this gist Jun 29, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  26. @pottava pottava revised this gist Jun 29, 2021. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions tutorial.md
    Original 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
    cd crc-linux-1.28.0-amd64/
    ./crc daemon
    ```

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

    ```bash
    cd crc-linux-1.28.0-amd64/ && ./crc start
    cd crc-linux-1.28.0-amd64/
    ./crc start
    ```
  27. @pottava pottava created this gist Jun 29, 2021.
    55 changes: 55 additions & 0 deletions tutorial.md
    Original 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
    ```