【问题标题】:kubectl version : Error from server (Forbidden)kubectl 版本:来自服务器的错误(禁止)
【发布时间】:2019-05-06 14:58:34
【问题描述】:

我想使用 jenkins 作业在 kube8 集群上部署我的 pod。 但是当检查 kubectl 版本时:

Client Version: version.Info{Major:"1", Minor:"11",
GitVersion:"v1.11.6",
GitCommit:"b1d75deca493a24a2f87eb1efde1a569e52fc8d9",
GitTreeState:"clean", BuildDate:"2018-12-16T04:39:52Z",
GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} Error
from server (Forbidden): <html><head><meta http-equiv='refresh'
content='1;url=/securityRealm/commenceLogin?from=%2Fversion%3Ftimeout%3D32s'/><script>window.location.replace('/securityRealm/commenceLogin?from=%2Fversion%3Ftimeout%3D32s');</script></head><body
style='background-color:white; color:white;'>

还有 kubectl 集群信息

Kubernetes master is running at http://localhost:8080

它没有与服务器建立连接。 我已经导出了所有必需的环境变量,例如 AWS_KEY 等来访问集群。当我 ssh 进入机器并手动导出 env 变量并检查 kubectl 版本时,它工作正常。

【问题讨论】:

  • 您在使用 AWS EKS 吗?您需要使用 kubeconfig 创建一个秘密文件,并将其添加到作业中。如果使用 AWS EKS,您还需要安装 AWS-authenticator
  • 不,我没有使用 AWS EKS。我已经使用 wesite 中的命令安装了 kubectl。我只定义了特定的 aws 凭据

标签: jenkins kubernetes kubernetes-helm


【解决方案1】:

您必须使用 jenkins 服务帐户来部署 pod。确保服务帐户附加了适当的角色和角色绑定,以在集群中部署 pod。

【讨论】:

    猜你喜欢
    • 2020-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-02
    • 2012-09-02
    • 1970-01-01
    • 2021-02-28
    相关资源
    最近更新 更多