"server could not find the requested resource (get pods)" error when deploying Helm chart using Jenkins "server could not find the requested resource (get pods)" error when deploying Helm chart using Jenkins kubernetes kubernetes

"server could not find the requested resource (get pods)" error when deploying Helm chart using Jenkins


This is 100% working I have this problem before.

At first builts jenkins user nextcopy config to /home/jenkins/.kube/

cp $HOME/.kube/config /home/jenkins/.kube/ or cp ~/.kube/config /home/jenkins/.kube/ 

And after that use

 chmod 777 /home/jenkins/.kube/config 

your kubernetes command need your kubernetes config file . it is like key or password for your kubernetes cluster so you should give the kubernetes config to your jenkins and after that it can run kubernetes commands

This is very good tutorial that help me to solve it .

tutorial

UPDATE1you should have jenkins user for adding jenkins user you should add jenkins user to your ubuntu or centos or ..

adduser jenkins

This is good link to adduserAdding user

UPDATE 2You should install kubectl in your server that you use it as jenkins so that kubectl command can work and after that please copy the config in ~/.kube/config in your kubernetes cluster to your jenkins server that previously you installed kubectl on it.


kubectl version

As per kubectl version skew policy:

kubectl is supported within one minor version (older or newer) of kube-apiserver.

So there is no problem to use v1.14 client with v1.13 server version.


helm issue

The error that you described usually happens when a previous release already exists with the same name. You can check this with helm ls --all. If it is the case, you should use helm upgrade instead.

There is a great chance that the existing release is in a FAILED state. If so, even helm upgrade may fail. You can delete the release with helm delete spacestudychart --purge, and try to install it again with helm install.

The helm tiller stores release info as ConfigMaps, so another cause of the problem may be invalid data for a "broken" release. If you have this problem your scenario should look like this:

$ helm ls --all$ kubectl get cm --all-namespaces -l OWNER=TILLERNAMESPACE     NAME               DATA   AGEkube-system   spacestudychart.v1   1      22h

In that case, delete the ConfigMap and try to install the release again:

$ kubectl delete cm  spacestudychart.v1 -n kube-system


The same command is working when I am running through terminal.

I suspect that you might be running commands from the terminal as root user, which will have access to your kubeconfig.

The jenkins pipelines will run under jenkins user, which may or may not have read access to the kubeconfig file. Make sure that jenkins user has read access to this file.