我在Container Engine集群中的Google Compute Engine实例上运行了一些Java应用程序。我将集群升级到最新版本(1.7.8)并将节点映像从容器优化操作系统更改为Ubuntu。现在我的pod在尝试使用此错误消息连接到云sql数据库时崩溃:
The Application Default Credentials are not available. They are available if running in Google Compute Engine.
Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials.
See https://developers.google.com/accounts/docs/application-default-credentials for more information.
服务帐户与使用范围https://www.googleapis.com/auth/sqlservice.admin
进行升级之前的帐户相同
有谁知道为什么我现在收到这个错误?最好的解决方案是创建环境变量吗?
理想情况下,您应该使用GOOGLE_APPLICATION_CREDENTIALS
环境变量。否则,您正在使用VM的“计算引擎默认服务帐户”。
有关最佳实践,请参阅本教程:https://cloud.google.com/kubernetes-engine/docs/tutorials/authenticating-to-cloud-platform