<p>Since I'm using Jenkins official helm chart which contains <a href="https://www.jenkins.io/projects/jcasc/" rel="nofollow noreferrer">JCasC plugin (Jenkins Configuration as Code)</a>, I was able to configure the static slave attachment using it including the creation of relevant credentials.</p>
<p>Here's the relevant section of the values.yaml file I use to install/upgrade the Jenkins helm chart:</p>
<pre><code>JCasC:
    defaultConfig: true
    configScripts:
      credentials: |
        credentials:
          system:
            domainCredentials:
              - credentials:
                  - usernamePassword:
                      scope: GLOBAL
                      id: &quot;CentOS_7.1_k4.14.11_ssh_password&quot;
                      username: 'jenkins'
                      password: ${decodeBase64:BASE64ENCODEDPASSWD}
                      description: &quot;Username/Password Credentials for CentOS_7.1_k4.14.11&quot;
      permanent-nodes: |
        jenkins:
          nodes:
            - permanent:
                name: &quot;CentOS 7.1 k4.14.11&quot;
                remoteFS: &quot;/home/jenkins&quot;
                numExecutors: 2
                labelString: &quot;CentOS_7.1_k4.14.11&quot;
                mode: EXCLUSIVE
                retentionStrategy: &quot;always&quot;
                launcher:
                  SSH:
                    jvmOptions: &quot;-Xms256m -Xmx1024m -XX:MaxPermSize=1024m&quot;
                    credentialsId: &quot;CentOS_7.1_k4.14.11_ssh_password&quot;
                    host: &quot;10.1.66.120&quot;
                    port: 22
                    sshHostKeyVerificationStrategy:
                      manuallyTrustedKeyVerificationStrategy:
                        requireInitialManualTrust: false
</code></pre>
<p>Now whenever I re-deploy or upgrade Jenkins helm chart, it automatically configures these credentials and add the static slave.</p>

CC BY-SA 4.0
2021-01-11T18:13:43.707Z
2021-01-11T18:13:43.707Z
Itai Ganot
<p>I've installed a Kubernetes cluster and deployed Jenkins in it which dynamically starts slave machines using Kubernetes plugin for Jenkins.</p>
<p>Some builds require a specific build machine with GNU make and specific kernel packages and for that I have a dedicated static virtual machine.</p>
<p>How can I automatically add the static virtual machine to Jenkins as a permanent slave? so when a Jenkins pod goes down and another starts it would automatically connect to the static slave?</p>

CC BY-SA 4.0
2021-01-08T11:35:05.970Z
are using and cloud provider? like EKS,AKS or GKE ?
Saikat Chakrabortty
CC BY-SA 4.0
2021-01-11T17:46:51.040Z
You can run that machine as a k8s-node and use taints and tolerations to ensure that is used by jenkins/k8s only for appropriate jobs. That way you don't need to worry about static slaves.
Software Engineer
<jenkins><kubernetes>
How to add a static slave to Jenkins running in Kubernetes?
Itai Ganot
# How to add a static slave to Jenkins running in Kubernetes?

(Asked by: username_0 on 2021-01-05)

I've installed a Kubernetes cluster and deployed Jenkins in it which dynamically starts slave machines using Kubernetes plugin for Jenkins.

Some builds require a specific build machine with GNU make and specific kernel packages and for that I have a dedicated static virtual machine.

How can I automatically add the static virtual machine to Jenkins as a permanent slave? so when a Jenkins pod goes down and another starts it would automatically connect to the static slave?

**Tags:** jenkins, kubernetes

> **Comments:**
> **username_1**: are using and cloud provider? like EKS,AKS or GKE ?  
> **username_2**: You can run that machine as a k8s-node and use taints and tolerations to ensure that is used by jenkins/k8s only for appropriate jobs. That way you don't need to worry about static slaves.  

---

## 1 answers

### Answer by username_0 on 2021-01-11. Score: 1 | Accepted answer

Since I'm using Jenkins official helm chart which contains JCasC plugin (Jenkins Configuration as Code), I was able to configure the static slave attachment using it including the creation of relevant credentials.
Here's the relevant section of the values.yaml file I use to install/upgrade the Jenkins helm chart:
JCasC:
    defaultConfig: true
    configScripts:
      credentials: |
        credentials:
          system:
            domainCredentials:
              - credentials:
                  - usernamePassword:
                      scope: GLOBAL
                      id: "CentOS_7.1_k4.14.11_ssh_password"
                      username: 'jenkins'
                      password: ${decodeBase64:BASE64ENCODEDPASSWD}
                      description: "Username/Password Credentials for CentOS_7.1_k4.14.11"
      permanent-nodes: |
        jenkins:
          nodes:
            - permanent:
                name: "CentOS 7.1 k4.14.11"
                remoteFS: "/home/jenkins"
                numExecutors: 2
                labelString: "CentOS_7.1_k4.14.11"
                mode: EXCLUSIVE
                retentionStrategy: "always"
                launcher:
                  SSH:
                    jvmOptions: "-Xms256m -Xmx1024m -XX:MaxPermSize=1024m"
                    credentialsId: "CentOS_7.1_k4.14.11_ssh_password"
                    host: "10.1.66.120"
                    port: 22
                    sshHostKeyVerificationStrategy:
                      manuallyTrustedKeyVerificationStrategy:
                        requireInitialManualTrust: false

Now whenever I re-deploy or upgrade Jenkins helm chart, it automatically configures these credentials and add the static slave.


---

