【发布时间】:2021-04-06 14:23:03
【问题描述】:
使用 WorkloadIdentity 运行 Pod 会在自动扩展启动时产生 Google 凭据错误。
我的应用程序配置了 WorkloadIdentity 以使用 Google Pub/Sub,还设置了 HorizontalPodAutoscaler 以将 Pod 扩展到最多 5 个副本。
当自动缩放器创建 pod 的副本时,会出现问题,GKE 的元数据服务器在几秒钟内无法工作,然后在 5 到 10 秒后没有产生错误。
这是自动缩放器创建 pod 后的错误日志。
WARNING:google.auth.compute_engine._metadata:Compute Engine Metadata server unavailable onattempt 1 of 3. Reason: timed out
WARNING:google.auth.compute_engine._metadata:Compute Engine Metadata server unavailable onattempt 2 of 3. Reason: timed out
WARNING:google.auth.compute_engine._metadata:Compute Engine Metadata server unavailable onattempt 3 of 3. Reason: timed out
WARNING:google.auth._default:Authentication failed using Compute Engine authentication due to unavailable metadata server
Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
这到底是什么问题?
当我从这里阅读文档时workload identity docs
"The GKE metadata server takes a few seconds to start to run on a newly created Pod"
我认为问题与这个问题有关,但是这种情况有解决方案吗?
谢谢
【问题讨论】:
标签: kubernetes google-kubernetes-engine gcloud