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?
Just in case, could you try creating the service account system:serviceaccount:jenkins:default
instead of jenkins
?