Google Kubernetes Engine 仮想クラスタを再作成して更新する

既存の Managed Service for Apache Spark on GKE 仮想クラスタの構成をコピーし、コピーした構成を更新して、更新された構成を使用して新しい Managed Service for Apache Spark on GKE クラスタを作成できます。

Managed Service for Apache Spark on GKE クラスタの再作成と更新

gcloud

  1. 環境変数を設定します。

    CLUSTER=existing Managed Service for Apache Spark on GKE  cluster name \
      REGION=region
    

  2. 既存の Managed Service for Apache Spark on GKE クラスタ構成を YAML ファイルにエクスポートします。

    gcloud dataproc clusters export $CLUSTER \
        --region=$REGION > "${CLUSTER}-config.yaml"
    

  3. 構成を更新します。

    1. kubernetesNamespace フィールドを削除します。このフィールドを削除すると、更新されたクラスタを作成するときに名前空間の競合を回避できます。

      kubernetesNamespace フィールドを削除する sed コマンドの例:

      sed -E "s/kubernetesNamespace: .+$//g" ${CLUSTER}-config.yaml
      

    2. Managed Service for Apache Spark on GKE 仮想クラスタ構成の設定を更新するために追加の変更(Spark componentVersion の変更など)を行います。

  4. 更新するクラスタと同じ名前のクラスタを作成する場合は、GKE 仮想クラスタ上の既存の Managed Service for Apache Spark を削除します(元のクラスタを置き換える場合)。

  5. 前の削除オペレーションが完了するのを待ってから、更新されたクラスタ構成をインポートして、更新された構成設定で新しい Managed Service for Apache Spark on GKE 仮想クラスタを作成します。

    gcloud dataproc clusters import $CLUSTER \
        --region=$REGION \
        --source="${CLUSTER}-config.yaml"

API

  1. 環境変数を設定します。

    CLUSTER=existing Managed Service for Apache Spark on GKE  cluster name \
      REGION=region
    

  2. 既存の Managed Service for Apache Spark on GKE クラスタ構成を YAML ファイルにエクスポートします。

    curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)"  "https://dataproc.googleapis.com/v1/projects/${PROJECT}/regions/${REGION}/clusters/${CLUSTER}?alt=json" > "${CLUSTER}-config.json"

  3. 構成を更新します。

    1. kubernetesNamespace フィールドを削除します。このフィールドを削除すると、更新されたクラスタを作成するときに名前空間の競合を回避できます。

      kubernetesNamespace フィールドを削除する jq コマンドの例:

      jq 'del(.virtualClusterConfig.kubernetesClusterConfig.kubernetesNamespace)'
      

    2. Managed Service for Apache Spark on GKE 仮想クラスタ構成の設定を更新するために追加の変更(Spark componentVersion の変更など)を行います。

  4. 更新するクラスタと同じ名前のクラスタを作成する場合(元のクラスタを置き換える場合)は、既存の Managed Service for Apache Spark on GKE 仮想クラスタを削除します。

    curl -X DELETE -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://dataproc.googleapis.com/v1/projects/${PROJECT}/regions/${REGION}/clusters/${CLUSTER}"
    

  5. 前の削除オペレーションが完了するのを待ってから、更新されたクラスタ構成をインポートして、更新された設定で新しい Managed Service for Apache Spark on GKE 仮想クラスタを作成します。

    curl -i -X POST  -H "Authorization: Bearer $(gcloud auth print-access-token)"  -H "Content-Type: application/json; charset=utf-8" -d "@${CLUSTER}-config.json" "https://dataproc.googleapis.com/v1/projects/${PROJECT}/regions/${REGION}/clusters?alt=json"
    

コンソール

Google Cloud コンソールでは、既存のクラスタの構成をインポートして GKE 仮想クラスタで Managed Service for Apache Spark を再作成するサポートはしていません。