Skip to content
Kubernetes Elastic agent plugin for
Branch: master
Clone or download

Kubernetes Elastic agent plugin for GoCD

Kubernetes Elastic Agent Plugin provides production grade support to run GoCD Elastic Agents on Kubernetes Cluster.


Read about setting up a Kubernetes cluster and using the GoCD elastic agent for Kubernetes in our documentation.

Configuring SSH keys for Kubernetes Elastic Agents

For accessing repositories over SSH, you need to add SSH keys to the elastic agent pod spec. Generate a new keypair, fetch the host key for the [host] you want to connect to and create the secret. The secret is structured to hold the entire contents of the .ssh folder on the GoCD agent.

Note: The steps provided below are for the official GoCD agent images listed on DockerHub.

Create a Kubernetes secret
$ ssh-keygen -t rsa -b 4096 -C "" -f gocd-agent-ssh -P ''
$ ssh-keyscan [host] > gocd_known_hosts
$ kubectl create secret generic gocd-agent-ssh \
    --from-file=id_rsa=gocd-agent-ssh \ \

Be sure to add the contents of to your [host].

Configure elastic agent profile

In the pod spec, specify the volumes section if not present and include the contents specified below:

  - name: ssh-secrets
    secretName: gocd-agent-ssh

In the container spec, specify the volumeMounts section if not present and include the contents specified below:

  - name: ssh-secrets
    readOnly: true
    mountPath: /home/go/.ssh

Pull image from private registry

Create a Kubernetes secret
kubectl create secret docker-registry \
	my-docker-registry \
	--namespace gocd \
	--docker-server=<docker_server_url> \
	--docker-username=<username> \
	--docker-password=<password> \
Configure pod yaml

In the pod spec, specify the imagePullSecrets section:

  - name: my-docker-registry


Documentation for installation is available here

Building the code base

To build the jar, run ./gradlew clean build

Deploy on dev machine

To build the jar, run ./gradlew deploy -Pserver_path=~/gocd


Enable Debug Logs

If you are on GoCD version 19.6 and above:

Edit the file wrapper-properties.conf on your GoCD server and add the following options. The location of the wrapper-properties.conf can be found in the installation documentation of the GoCD server.

# We recommend that you begin with the index `100` and increment the index for each system property

If you're running with GoCD server 19.6 and above on docker using one of the supported GoCD server images, set the environment variable GOCD_SERVER_JVM_OPTIONS:

docker run -e "" ...

If you are on GoCD version 19.5 and lower:

  • On Linux:

    Enabling debug level logging can help you troubleshoot an issue with this plugin. To enable debug level logs, edit the file /etc/default/go-server (for Linux) to add:


    If you're running the server via ./ script:

  • On windows:

    Edit the file config/wrapper-properties.conf inside the GoCD Server installation directory (typically C:\Program Files\Go Server):

    # config/wrapper-properties.conf
    # since the last "" index is 15, we use the next available index.


Copyright 2019 ThoughtWorks, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.