A toolbox container, meant to be used in Jenkinsfile; kubectl and other YAML manipulation utilities
8.9K
A toolbox container, meant to be used in Jenkinsfile's; kubectl and other YAML manipulation utilities.
Included:
It was mostly copied from lachie83, thanks.
This uses kubernetes-cli plugin to get a working KUBECONFIG.
You need to create a Credential of type Certificate (k8s-cert-credentials in this example) in Jenkins.
node {
ansiColor('xterm') {
stage('Kubernetes Toolbox Example') {
docker.image('rpardini/k8s-jenkins-toolbox:latest').inside() { // run block inside the toolbox container
withKubeConfig(credentialsId: 'k8s-cert-credentials', serverUrl: 'https://some.k8s.server') { // create KUBECONFIG file
checkout scm // to get a git checkout inside the toolbox container
sh 'kubectl version'
sh 'kubectl cluster-info'
sh 'helm --help'
sh 'kubernetes-deploy --help'
sh 'cat some/yaml/in/your/repo/file.yaml | yq -y .'
}
}
}
}
/// ...
}
Content type
Image
Digest
Size
89.1 MB
Last updated
over 6 years ago
docker pull rpardini/k8s-jenkins-toolbox:v1.17.2-0