When trying to connect jenkins and kubernetes, Jenkins job throws the following error

6/6/2020

Started by user admin.<br> Running as SYSTEM.<br> Building in workspace /var/lib/jenkins/workspace/myjob<br> myjob $ /bin/sh -xe /tmp/jenkins8491647919256685444.sh<br>

  • sudo kubectl get pods

error: the server doesn't have a resource type "pods"<br> Build step 'Execute shell' marked build as failure<br> Finished: FAILURE

-- Devkishan joshi
jenkins-pipeline
kubernetes

1 Answer

6/8/2020

It looks to me that the authentication credentials were not set correctly. Please copy the kubeconfig file /etc/kubernetes/admin.conf to ~/.kube/config? Also check that the KUBECONFIG variable is set. It would also help to increase the verbose level using the flag --v=99.

Please take a look: kubernetes-configuration.

-- Malgorzata
Source: StackOverflow