<p>Have a look at the documentation presented here:</p>

<p><a href="https://github.com/jenkinsci/kubernetes-plugin" rel="nofollow noreferrer">https://github.com/jenkinsci/kubernetes-plugin</a></p>

<p>You need to specify a Kubernetes pod in your pipeline. An example of your use case would look similar to this for a single python container. You'll notice that containers: [] expects an array so you can include additional containers.</p>

<pre><code>def label = "mypod-${UUID.randomUUID().toString()}"

podTemplate(label: label, containers: [
    containerTemplate(name: 'python', image: 'python:3.7-alpine', ttyEnabled: true, command: 'cat'),
]) {
    node(label) {
        stage('Get a Python project') {
            git 'https://github.com/oğuz/project.git'
            container('python') {
                stage('Test a Python project') {
                    sh "python -m -v py.test TEST_FILE.py "
                }
            }
        }
    }
}
</code></pre>

CC BY-SA 4.0
2018-07-23T11:02:21.673Z
I've runned this template groovy script before . I found the code block at kubernetes plugin , by the default is JNLP_SLAVE at it is offical image  at link:  https://hub.docker.com/r/jenkinsci/jnlp-slave/  so that we change default : JNLP_SLAVE notation . Thanks for your answer :))
ColossusMark1
CC BY-SA 4.0
2018-07-20T18:40:33.387Z
2018-07-20T18:40:33.387Z
casey vega
<p>I'm working on huge pipeline with different development environment (python, node, java). 
For manage this CI pipeline our teams using Jenkins at Kubernetes environment. </p>

<p>I want to give PipeLine node annotation at Groovy Script show as below . </p>

<pre><code> node("test-py") {
   sh "python -m -v py.test TEST_FILE.py "
 }
</code></pre>

<p>How I can create pod with image , with Jenkins Kubernetes Plugin . </p>

<jenkins><continuous-integration><kubernetes><python>
Jenkins Node Image at Kubernetes Plugin
ColossusMark1
# Jenkins Node Image at Kubernetes Plugin

(Asked by: username_0 on 2018-07-20)

I'm working on huge pipeline with different development environment (python, node, java). 
For manage this CI pipeline our teams using Jenkins at Kubernetes environment. 
I want to give PipeLine node annotation at Groovy Script show as below . 
 node("test-py") {
   sh "python -m -v py.test TEST_FILE.py "
 }

How I can create pod with image , with Jenkins Kubernetes Plugin .

**Tags:** jenkins, continuous-integration, kubernetes, python


---

## 1 answers

### Answer by username_1 on 2018-07-20. Score: 0 | Accepted answer

Have a look at the documentation presented here:
https://github.com/jenkinsci/kubernetes-plugin
You need to specify a Kubernetes pod in your pipeline. An example of your use case would look similar to this for a single python container. You'll notice that containers: [] expects an array so you can include additional containers.
def label = "mypod-${UUID.randomUUID().toString()}"

podTemplate(label: label, containers: [
    containerTemplate(name: 'python', image: 'python:3.7-alpine', ttyEnabled: true, command: 'cat'),
]) {
    node(label) {
        stage('Get a Python project') {
            git 'https://github.com/oğuz/project.git'
            container('python') {
                stage('Test a Python project') {
                    sh "python -m -v py.test TEST_FILE.py "
                }
            }
        }
    }
}

> **Comments:**
> **username_0**: I've runned this template groovy script before . I found the code block at kubernetes plugin , by the default is JNLP_SLAVE at it is offical image  at link:  https://hub.docker.com/r/jenkinsci/jnlp-slave/  so that we change default : JNLP_SLAVE notation . Thanks for your answer :))  

---

