繁体   English   中英

在Jenkins中配置kubernetes插件

[英]Configuring kubernetes plugin in Jenkins

我正在尝试在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阅读器角色:

# 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。

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

想通了,我使用凭据作为纯文本。 我将其更改为kubernetes secret,并且有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM