0

I am trying to configure kubernetes plugin in Jenkins. Here are the details I am putting in:

enter image description here

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.

Pensu
  • 3,263
  • 10
  • 46
  • 71

2 Answers2

1

I think it's not working because you didn't provide the certificate. This worked for me.

shmandrija
  • 59
  • 3
1

Figured it out, I was using credentials as plain text. I changed that to kubernetes secret, and it worked.

Pensu
  • 3,263
  • 10
  • 46
  • 71