从kubernetesincubator/clientpython连接到gke集群时出错

2024-05-29 07:00:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用kubernetes-incubator/client-python库连接到我的gke集群。我只运行一个基本查询:

from kubernetes import client, config
# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()
v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

我得到一个错误:

^{pr2}$

我以为我的kube.config文件文件。所以我删除它并再次创建集群,以便重新创建一个新的kube.config文件文件。问题依然存在。你能帮我一下吗?在


Tags: 文件inclientconfigfor集群kubernetesincubator
1条回答
网友
1楼 · 发布于 2024-05-29 07:00:29

这是你的云平台问题。找不到它们,您无法与服务交互。Here's some instructions关于如何设置这些。将GOOGLE_APPLICATION_CREDENTIALS环境变量指向凭据文件或通过SDK进行身份验证。在

相关问题 更多 >

    热门问题