https://github.com/rpardini/k8s-jenkins-toolbox
A toolbox container, meant to be used in Jenkinsfile's; kubectl and other YAML manipulation utilities
https://github.com/rpardini/k8s-jenkins-toolbox
Last synced: 3 months ago
JSON representation
A toolbox container, meant to be used in Jenkinsfile's; kubectl and other YAML manipulation utilities
- Host: GitHub
- URL: https://github.com/rpardini/k8s-jenkins-toolbox
- Owner: rpardini
- License: apache-2.0
- Created: 2018-07-05T11:26:24.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T11:35:19.000Z (over 3 years ago)
- Last Synced: 2025-06-05T05:03:07.678Z (about 1 year ago)
- Language: Dockerfile
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k8s-jenkins-toolbox
A toolbox container, meant to be used in Jenkinsfile's; kubectl and other YAML manipulation utilities.
Included:
- kubectl
- helm
- kubernetes-deploy
- jq
- yq
- curl/bash/git
It was mostly copied from [lachie83](https://github.com/lachie83/k8s-kubectl), thanks.
## Example Jenkinsfile fragment
This uses [kubernetes-cli](https://github.com/jenkinsci/kubernetes-cli-plugin) plugin to get a working KUBECONFIG.
You need to create a Credential of type Certificate (`k8s-cert-credentials` in this example) in Jenkins.
```groovy
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 .'
}
}
}
}
/// ...
}
```