Reputation: 657
After creating a Service Account for Jenkins with the commands:
kubectl -n jenkins create sa jenkins
kubectl create clusterrolebinding jenkins --clusterrole cluster-admin --serviceaccount=jenkins:jenkins
and adding the certificate in Jenkins (Manage Jenkins --> Configure System --> Add Cloud) I get the error message
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"..
It seems like Jenkins tries to use the default
Serviceaccount.
How can this be fixed?
Upvotes: 3
Views: 2337
Reputation: 1
You can try it
kubectl create clusterrolebinding jenkins --clusterrole admin --
serviceaccount=jenkins:default -n jenkins
Remember to replace the parameters.
Upvotes: 0
Reputation: 67
This one is work for me
kubectl create clusterrolebinding jenkins --clusterrole cluster-admin --serviceaccount=jenkins:default
Upvotes: 2
Reputation: 8825
Just in case, could you try creating the service account system:serviceaccount:jenkins:default
instead of jenkins
?
Upvotes: 0