自称フルスタックエンジニアのぶろぐ。

pythonやreactや、gcpやawsなどなどについて書いていこうかと思います。

GCP GKE(k8s) ノードがオートスケールしない or ノードプールが作れない

ノードが一定数からスケールアップしなかったり、ノードプールを作れなかった事態に陥ったので共有します。

下記のコマンドで、プリミティブなノードプールを作りたかった。

$ gcloud container node-pools create [node名] --zone asia-northeast1-a --cluster [クラスター名] --scopes gke-default,bigquery,logging-write,monitoring,monitoring-write,sql,sql-admin,storage-full --preemptible --machine-type custom-4-10240

表示されたエラー

This will enable the autorepair feature for nodes. Please see https://cloud.google.com/kubernetes-engine/docs/node-auto-repair for more information on node autorepairs.
WARNING: Starting in Kubernetes v1.10, new clusters will no longer get compute-rw and storage-ro scopes added to what is specified in --scopes (though the latter will remain included in the default --scopes). To use these scopes, add them explicitly to --scopes. To use the new behavior, set container/new_scopes_behavior property (gcloud config set container/new_scopes_behavior true).
ERROR: (gcloud.container.node-pools.create) ResponseError: code=403, message=
        (1) insufficient regional quota to satisfy request: resource "CPUS": request requires '12.0' and is short '2.0'. project has a quota of '24.0' with '10.0' available
        (2) insufficient regional quota to satisfy request: resource "IN_USE_ADDRESSES": request requires '3.0' and is short '3.0'. project has a quota of '8.0' with '0.0' available.

これはCPUの上限と、IPアドレスの上限に引っかかっているという内容です。

解消するには、プロジェクトで使用できる上限を引き上げてもらう必要があります。

メニューから[IAMと管理] > [割り当て]

を選択すると、上限がリストで表示されます

デフォルトでは、下記のようにCPUは24コアまで。

IPアドレスは8個までとなっていました。

f:id:murabo408:20181002140703p:plain

申請は、変更したい項目にチェックを付けて、画面上部の[割り当てを編集]から申請を行うことができます。

時間かかるのかな・・・っと心配でしたが、ほぼ即時対応でした。

murabo.hatenablog.com