/ / Authentic Jenkins to Google Cloud Platform Kubernetes-jenkins、kubernetes、google-cloud-platform

Google Cloud Platformへの本物のJenkins - クイックネット - jenkins、kubernetes、google-cloud-platform

GCPクラスターに最新の1.6.4 Kubernetesがインストールされていますが、Jenkinsに承認を与える方法がわかりません。

私はジェンキンスファイルに2つの新しいコマンドを追加しようとしました

sh(「gcloud config set compute / zone us-central1-b」)

sh(「gcloud container clusters get-credentials te-cluster」)

1回目は成功しました 2番目の失敗

エラー:(gcloud.container.clusters.get-credentials)ResponseError:code = 403、message = Requestの認証スコープが不十分でした。

回答:

回答№1は0

まず、次を使用して資格情報を作成します。 案内する Google Cloud API Manager > 資格情報 > 資格情報を作成する Compute EngineのデフォルトサービスアカウントのJSONキーを作成します。

それから、 gcloud auth activate-service-account --key-file key.json

JSONファイルのコンテンツを変数に保存できます