Jenkins Kubernetes Serviceaccount无法列出Pods

时间:2017-10-02 05:25:47

标签: jenkins kubernetes

使用以下命令为Jenkins创建服务帐户后:

kubectl -n jenkins create sa jenkins

kubectl create clusterrolebinding jenkins --clusterrole cluster-admin --serviceaccount=jenkins:jenkins

并在Jenkins中添加证书(管理Jenkins - >配置系统 - >添加云)我收到错误消息

Error connecting to https://169.46.7.238:21769: 
Failure executing: GET at: 
https://169.46.7.238:21769/api/v1/namespaces/jenkins/pods. 
Message: Forbidden!Configured service account doesn't have access. 
Service account may have been revoked. 
User "system:serviceaccount:jenkins:default" cannot list pods in the namespace "jenkins"..

Jenkins似乎试图使用default Serviceaccount。

如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

以防万一,您是否可以尝试创建服务帐户system:serviceaccount:jenkins:default而不是jenkins