Skip to content

Instantly share code, notes, and snippets.

@varshavaradarajan
Last active May 20, 2019 19:46
Show Gist options
  • Save varshavaradarajan/850c1350f2ae33b1160b17817ef5f870 to your computer and use it in GitHub Desktop.
Save varshavaradarajan/850c1350f2ae33b1160b17817ef5f870 to your computer and use it in GitHub Desktop.
This is the yaml file that can be used with the elastic profile for the k8s plugin. This downloads kubectl and helm and makes it available for gocd agent to deploy to a cluster.
apiVersion: v1
kind: Pod
metadata:
name: gocd-agent
labels:
app: web
spec:
volumes:
- name: kubectl-and-helm
emptyDir: {}
initContainers:
- name: download-kubectl-and-helm
image: "alpine:latest"
imagePullPolicy: "IfNotPresent"
volumeMounts:
- name: kubectl-and-helm
mountPath: /download
workingDir: /download
command: ["/bin/sh"]
args:
- "-c"
- 'apk add curl && curl -LO https://gist.githubusercontent.com/varshavaradarajan/ec3c2192937f8ff024d64df5ec85501b/raw/28c5c080464e3535da70a260117ae5f36a85bac3/download_kubectl_and_helm.sh && chmod +x download_kubectl_and_helm.sh && sh download_kubectl_and_helm.sh'
containers:
- name: gocd-agent-container
image: gocd/gocd-agent-docker-dind:v19.3.0
volumeMounts:
- name: kubectl-and-helm
mountPath: /usr/local/bin/helm
subPath: helm
- name: kubectl-and-helm
mountPath: /usr/local/bin/tiller
subPath: tiller
- name: kubectl-and-helm
mountPath: /usr/local/bin/kubectl
subPath: kubectl
securityContext:
privileged: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment