configuration-as-code-plugin/demos/kubernetes
Nassos Kat 249e9a2446
Cleanup slave terminology from documentation (#1482)
* eliminate "slave" terminology

* fix typo

Co-authored-by: Tim Jacomb <t.jacomb@kainos.com>

* Addressed review comment - replace image with correct one

Co-authored-by: Tim Jacomb <t.jacomb@kainos.com>

Co-authored-by: Tim Jacomb <t.jacomb@kainos.com>
2020-10-12 09:26:25 +01:00
..
README.md Cleanup slave terminology from documentation (#1482) 2020-10-12 09:26:25 +01:00
adv_config.yml Cleanup slave terminology from documentation (#1482) 2020-10-12 09:26:25 +01:00
config.yml fix the location setting of jenkins (#689) 2019-01-10 11:19:38 +01:00
jenkins.yml 🗑️ Codacy markdown issues (#848) 2019-04-20 15:50:58 +02:00
service-account.yml 🗑️ Codacy markdown issues (#848) 2019-04-20 15:50:58 +02:00

README.md

Configure Kubernetes plugin

Jenkins can be installed in Kubernetes and preconfigured to run jobs (and other options) in the Kubernetes cluster, using YAML stored in a ConfigMap. See config.yml for the ConfigMap definition.

Advanced sample configuration

unclassified:
  location:
    url: http://jenkins/

jenkins:
  clouds:
    - kubernetes:
        name: "advanced-k8s-config"
        serverUrl: "https://avanced-k8s-config:443"
        serverCertificate: "serverCertificate"
        skipTlsVerify: true
        credentialsId: "advanced-k8s-credentials"
        namespace: "default"
        jenkinsUrl: "http://jenkins/"
        jenkinsTunnel: "jenkinsTunnel"
        containerCapStr: 42
        maxRequestsPerHostStr: 64
        retentionTimeout: 5
        connectTimeout: 10
        readTimeout: 20

        templates:
          - name: "test"
            serviceAccount: "serviceAccount"
            instanceCap: 1234
            idleMinutes: 0
            label: "label"
            volumes:
              - hostPathVolume:
                  mountPath: "mountPath"
                  hostPath: "hostPath"

            containers:
              - name: "name"
                image: "image"
                privileged: true
                alwaysPullImage: true
                command: "command"
                args: "args"
                workingDir: "workingDir"
                ttyEnabled: true
                resourceRequestCpu: "resourceRequestCpu"
                resourceRequestMemory: "resourceRequestMemory"
                resourceLimitCpu: "resourceLimitCpu"
                resourceLimitMemory: "resourceLimitMemory"
            imagePullSecrets:
              - name: "imagePullSecrets"

            envVars:
              - envVar:
                  key: "FOO"
                  value: "BAR"

          - name: "k8s-agent"
            namespace: "default"
            label: "linux-x86_64"
            nodeUsageMode: EXCLUSIVE
            containers:
              - name: "jnlp"
                image: "jenkins/inbound-agent:latest"
                alwaysPullImage: true
                workingDir: "/home/jenkins"
                ttyEnabled: true
                resourceRequestCpu: "500m"
                resourceLimitCpu: "1000m"
                resourceRequestMemory: "1Gi"
                resourceLimitMemory: "2Gi"
            volumes:
              - emptyDirVolume:
                  memory: false
                  mountPath: "/tmp"
            idleMinutes: "1"
            activeDeadlineSeconds: "120"
            slaveConnectTimeout: "1000"

Example installation on Kubernetes

kubectl apply -f service-account.yml
kubectl apply -f config.yml
kubectl apply -f jenkins.yml