【发布时间】:2021-06-28 11:03:35
【问题描述】:
我在Google Kubernetes Engine 上托管的GoLang 项目中使用Firebase。
我遵循的步骤:
-
在 firebase 帐户上启用 firebase admin SDK。它为我生成了一个服务帐户
JSON。这还在我的 Google 控制台服务凭据下创建了一个服务帐户。 -
关注此answer 并使用
kubectl create secret generic google-application-credentials --from-file=./sample-project.json添加新密钥 -
对我的
deployment.YAML文件进行了更改(添加了卷挂载和环境变量)spec: containers: - image: gcr.io/sample-ee458/city:0.27 name: city-app volumeMounts: - name: google-application-credentials-volume mountPath: /etc/gcp readOnly: true env: - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/gcp/application-credentials.json -
在同一个文件中设置卷
volumes: - name: google-application-credentials-volume secret: secretName: google-application-credentials items: - key: application-credentials.json # default name created by the create secret from-file command path: application-credentials.json -
运行
kubectl apply -f deployment.yaml并使用docker push命令进行部署。
它把我扔了error getting credentials using google_application_credentials environment variable gke。我在这里想念什么?任何提示都会很明显。
【问题讨论】:
标签: docker kubernetes google-cloud-platform google-kubernetes-engine