-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
-
kubernetes 1.24.0
Background:
We started leveraging the Kubernetes plugin to define agents using kubernetes templates. This is a great new feature but allows non admins to generate new templates even within their pipelines. But since these non admins do not have access to the Kubernetes back end or the logging within Jenkins, they do not see when or why one of these templates fails
Issue:
When a non-admin user creates a k8s template which is badly formed they are unable to see that the container/pod is failing because it is just "waiting on $LABEL"
Steps to reproduce:
Create a pipeline job
Create a template in that job with a badly defined docker image name
Watch the job fail to start because it can not find its label
If you are not an admin you can not see why the container/pod is failing to start because you can not access the k8s logs or the `Manage Jenkins> System Log` area of Jenkins to create a custom logger and see the cause for failure
Resolution:
We need a way in the job or similar to see why the container is failing to start, perhaps just a return code from Kubernetes. Or we need to not allow them to define templates on a job level so that non-admins can not create templates at all.
- is duplicated by
-
JENKINS-56396 A pipeline with a bad containerTemplate does not fail
-
- Closed
-
- is related to
-
JENKINS-53205 Validate Pipeline Pod Template Values
-
- Open
-
- links to
Right now the only workaround is to do some strange-ness within a pipeline where you create a pipeline and parallel the template along with a groovy script(In my case I included it within a global shared library).
So here are the steps I used:
1. Create a system log called "Kubernetes Log" with the `org.csanchez.jenkins.plugins.kubernetes` logger set to ALL
2. Create a pipeline job with a parallel statement which runs the template and loops through the following script until the template spins up:
This will show the messages relating to `searchString` which should be the name of your template.