rpardini/k8s-jenkins-toolbox

By rpardini

Updated over 6 years ago

A toolbox container, meant to be used in Jenkinsfile; kubectl and other YAML manipulation utilities

Image
0

8.9K

rpardini/k8s-jenkins-toolbox repository overview

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, thanks.

Example Jenkinsfile fragment

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 .'
                }
            }
        }
    }
    /// ...  
}

Tag summary

Content type

Image

Digest

Size

89.1 MB

Last updated

over 6 years ago

docker pull rpardini/k8s-jenkins-toolbox:v1.17.2-0