Jenkins – Kubeconfig


To store and switch between Kubernetes configurations, you can use the Kubernetes CLI plugin, to work with it, "kubectl" must be installed in the system

Install the plugin

Go to "Manage Jenkins"


Section "Manage Plugins"


Go to the "Available" tab and in the search indicate "Kubernetes CLI"

Install it.


Add Kubernetes config


Go to the "Credentials" and create the "Secret file"


We load a config and we specify "ID". Save.



An example of using a plugin in Pipeline:

pipeline {
  agent any
  stages {   
    stage("K8s") {
      steps {
        withKubeConfig([credentialsId: 'kubeconfig-artem-services-staging']) {
          script {
            sh "kubectl get pod"
0 0 vote
Article Rating

Tagged: Tags

Уведомление о
Inline Feedbacks
View all comments