I am trying to deploy my Kubernetes Helm chart for sample Kubernetes cluster deployment. I created a sample Helm chart and added Docker image reference and deployed the Helm chart using terminal command helm install <my-chartname>
. And micro service is accessing successfully without any problem.
After that I created a Jenkins pipeline job and added only one stage that containing the step for deployment. I added like the following way,
pipeline
{
agent any
stages
{
stage ('helmchartinstall')
{
steps
{
sh 'helm install spacestudychart'
}
}
}
}
And I am getting the error like following ,
[Pipeline] { (helmchartinstall)
[Pipeline] sh
+ helm install spacestudychart
Error: the server could not find the requested resource (get pods)
The same command is working when I am running through terminal.
Update
To upgrade tiller to latest version, I run the helm init --upgrade
command on terminal. But the error remains still.
Output of "helm version" is like the following,
Client: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}
Output of "kubectl version --short" is like the following,
Client Version: v1.14.1
Server Version: v1.13.5
When I run command "kubectl --v=5 get pods; helm install spacestudychart" , I am getting the console output like the following,
+ kubectl --v=5 get pods
I0604 07:44:46.035459 2620 cached_discovery.go:121] skipped caching discovery info due to yaml: line 10: mapping values are not allowed in this context
I0604 07:44:46.152770 2620 cached_discovery.go:121] skipped caching discovery info due to yaml: line 10: mapping values are not allowed in this context
I0604 07:44:46.152819 2620 shortcut.go:89] Error loading discovery information: yaml: line 10: mapping values are not allowed in this context
I0604 07:44:46.283598 2620 cached_discovery.go:121] skipped caching discovery info due to yaml: line 10: mapping values are not allowed in this context
I0604 07:44:46.374088 2620 cached_discovery.go:121] skipped caching discovery info due to yaml: line 10: mapping values are not allowed in this context
I0604 07:44:46.467938 2620 cached_discovery.go:121] skipped caching discovery info due to yaml: line 10: mapping values are not allowed in this context
F0604 07:44:46.468122 2620 helpers.go:114] error: yaml: line 10: mapping values are not allowed in this context
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 255
Finished: FAILURE
Do I need to upgrade the kubectl version? What is the exact problem when running with Jenkins?
RoleBinding
(orClusterRoleBinding
) that grants them access to the Pods resource; runningkubectl get pods
right before that helm command may help distinguish the two, optionally with--v 15
to surface the actual underlying error message – mdanielget pods
in the jenkins script, so it would run under the same circumstances as does your helm command – mdaniel