【问题标题】:Configuring kubernetes plugin in Jenkins在 Jenkins 中配置 Kubernetes 插件
【发布时间】:2019-03-08 11:47:05
【问题描述】:

我正在尝试在 Jenkins 中配置 kubernetes 插件。以下是我要输入的详细信息:

现在,当我单击测试连接时,出现以下错误:

Error testing connection https://xx.xx.xx.xx:8001: Failure executing: GET at: https://xx.xx.xx.xx:8001/api/v1/namespaces/default/pods. Message: Unauthorized! Configured service account doesn't have access. Service account may have been revoked. Unauthorized.

在google了一番后,我意识到可能是因为角色绑定,所以我为我的default服务帐户创建了一个角色绑定:

# kubectl describe rolebinding jenkins
Name:         jenkins
Labels:       <none>
Annotations:  <none>
Role:
  Kind:  ClusterRole
  Name:  pod-reader
Subjects:
  Kind            Name     Namespace
  ----            ----     ---------
  ServiceAccount  default  default

这里是 pod-reader 角色:

# kubectl describe role pod-reader
Name:         pod-reader
Labels:       <none>
Annotations:  <none>
PolicyRule:
  Resources  Non-Resource URLs  Resource Names  Verbs
  ---------  -----------------  --------------  -----
  pods       []                 []              [get watch list]

但我仍然遇到同样的错误。这里还有什么需要做的吗? TIA。

【问题讨论】:

    标签: jenkins kubernetes jenkins-plugins


    【解决方案1】:

    我认为它不起作用,因为您没有提供证书。 This 为我工作。

    【讨论】:

      【解决方案2】:

      想通了,我使用的是纯文本凭据。我将其更改为 kubernetes secret,并且它起作用了。

      【讨论】:

        猜你喜欢
        • 2016-02-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-06-22
        • 1970-01-01
        • 2022-06-13
        • 2014-02-18
        相关资源
        最近更新 更多