小编My *_*URU的帖子

如何增加 gcloud 重新身份验证超时,目前每 1 小时过期

我运行以下命令

  • 使用我的公司电子邮件 ID (ldap) 向 google cloud 进行身份验证
  • 更新我的本地计算机上的 kubeconfig 文件
  • 使用 kube-api-proxy 从本地计算机访问 k8s 控制平面。(我使用此代理来访问控制平面,因为 GKE 控制平面 vpc 和我的公司网络之间没有 VPC 对等)
gcloud auth login --no-launch-browser  ## I use corporate email id to authenticate
gcloud container clusters get-credentials <>gke_cluster_name> --region <region> --project <gcp_project>
export https_proxy=<kube_api_proxy>:8118  ## Proxy to connect to k8s controlplane
kubectl get no
Run Code Online (Sandbox Code Playgroud)

每隔 1 小时,我必须重复上述步骤来重新进行身份验证,因为我会失败并出现以下错误,否则当我尝试连接到 k8S 时

Unable to connect to the server: error executing access token command "/usr/lib64/google-cloud-sdk/bin/gcloud 
config config-helper --format=json": err=exit status 1 output= stderr=ERROR: …
Run Code Online (Sandbox Code Playgroud)

authentication google-cloud-platform gcloud google-kubernetes-engine kubectl

2
推荐指数
1
解决办法
2203
查看次数