Hi,
I'm using Jenkins 2.176.2 and Kubernetes Plugin 1.18.1.
I defined PodTemplate via GUI with RawYaml definition and i would like to use this in my declarative pipeline:
pipeline {
agent {
kubernetes {
cloud 'mycloud'
defaultContainer 'jnlp'
inheritFrom 'my-buildslave'
}
}
However pipeline execution stucks here:
Still waiting to schedule task
All nodes of label 'run-jenkins-buildslave-on-kube_84-7gg7p’ are offline
Pod is not being created on k8s.
When i add any yaml definition as below:
pipeline {
agent {
kubernetes {
cloud 'mycloud'
defaultContainer 'jnlp'
inheritFrom 'my-buildslave'
yaml """
spec:
containers:
- name: golang
image: golang:1.6.3-alpine
command:
- cat
tty: true
"""
}
}
Then POD has been started but it doesn't inherit from pod template - it runs 2 containers: jnlp and golang. How to use inheritance or some other mechanism so i dont need to define my pod in each pipeline?
My Kubernetes Pod template raw definition:
spec:
imagePullSecrets:
- name: mysec
containers:
- name: maven
image: maven:latest
imagePullPolicy: Always
command:
- cat
tty: true
env:
- name: DOCKER_HOST
value: tcp://localhost:2375
resources: {}
- name: dind
image: docker:18.05-dind
securityContext:
privileged: true
volumeMounts:
- name: dind-storage
mountPath: /var/lib/docker
resources: {}