I am trying to configure kubernetes plugin in Jenkins. Here are the details I am putting in:
Now, when I click on test connection, I get the following error:
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.
After doing some google, I realized it might be because of role binding, so I create a role binding for my default
service account:
# kubectl describe rolebinding jenkins
Name: jenkins
Labels: <none>
Annotations: <none>
Role:
Kind: ClusterRole
Name: pod-reader
Subjects:
Kind Name Namespace
---- ---- ---------
ServiceAccount default default
Here is the pod-reader role:
# kubectl describe role pod-reader
Name: pod-reader
Labels: <none>
Annotations: <none>
PolicyRule:
Resources Non-Resource URLs Resource Names Verbs
--------- ----------------- -------------- -----
pods [] [] [get watch list]
But I still get the same error. Is there anything else that needs to be done here? TIA.
Figured it out, I was using credentials as plain text. I changed that to kubernetes secret, and it worked.
I think it's not working because you didn't provide the certificate. This worked for me.