• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • kubernetes-cli-plugin
    • Jenkins 2.156
      Kubernetes-cli 1.4.0
      Kubernetes-credentials 0.4.0

      I setup a kubernetes credentials with raw content:

      When I use it referring only with the credentials-id as follows:

      steps {
       withKubeConfig([credentialsId: 'kubernetes-mkp-int' ,
       ]) {
       sh 'kubectl get pods'
       sh 'helm get mkp-int --tiller-namespace mkp-int'
       }
       }

       

       

      It fails:

       

      {[Pipeline] withKubeConfig$ kubectl config set-cluster k8s --server=null --insecure-skip-tls-verify=true Cluster "k8s" set.
      [Pipeline] // withKubeConfig[Pipeline] }
      [Pipeline] // withEnv[Pipeline] }
      [Pipeline] // node
      [Pipeline] }[Pipeline] // stage[Pipeline] }
      [Pipeline] // withEnv[Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // node[Pipeline] End of PipelineERROR: Unsupported Credentials type com.microsoft.jenkins.kubernetes.credentials.KubeconfigCredentials
      Finished: FAILURE

       

       

      In the workspace, a kubeconfig file has been created but it has nothing in common with my credentials defined.

       

      cat .kube6838469646141525001config
      apiVersion: v1
      clusters:
      - cluster:
      insecure-skip-tls-verify: true
      server: "null"
      name: k8s
      contexts: []
      current-context: ""
      kind: Config
      preferences: {}
      users: []

       

      I have one kubernetes credentials added and I have been tested that changing the 

      I'm doing something wrong or it's a bug?

       

          [JENKINS-55544] kubernetes-plugin creates blank kubeconfig

          Max Laverse added a comment -

          Hi rubick,
          What type of credential do you use ?
          The plugins detects a credential as being a raw Kube configuration if it's a FileCredential (I'll fix the doc once this issue is solved)
          https://github.com/jenkinsci/kubernetes-cli-plugin/blob/master/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriter.java#L82-L83

          Max Laverse added a comment - Hi rubick , What type of credential do you use ? The plugins detects a credential as being a raw Kube configuration if it's a FileCredential (I'll fix the doc once this issue is solved) https://github.com/jenkinsci/kubernetes-cli-plugin/blob/master/src/main/java/org/jenkinsci/plugins/kubernetes/cli/kubeconfig/KubeConfigWriter.java#L82-L83

          The credentials kind is "Kubernetes configuration (kubeconfig)" with FileCredential works fine.

          I find confused how to use a kubeconfig credentials in general. I was following this doc https://wiki.jenkins.io/display/JENKINS/Kubernetes+Cli+Plugin that used its own credentials type.

           

          Nevertheless, thanks for clarify that I need to use File Credentials.

           

           

          Ruben Fernandez added a comment - The credentials kind is "Kubernetes configuration (kubeconfig)" with FileCredential works fine. I find confused how to use a kubeconfig credentials in general. I was following this doc https://wiki.jenkins.io/display/JENKINS/Kubernetes+Cli+Plugin  that used its own credentials type.   Nevertheless, thanks for clarify that I need to use File Credentials.    

          Max Laverse added a comment -

          Apparently this credential type comes from https://github.com/jenkinsci/kubernetes-cd-plugin.

          What did you mean with "I find confused how to use a kubeconfig credentials in general. I was following this doc https://wiki.jenkins.io/display/JENKINS/Kubernetes+Cli+Plugin that used its own credentials type." ?

          It was from another page right ? Because I only listed the supported plugins here, and credentials from kubernetes-cd-plugin are not part of it. But I might have put a broken link somewhere, just checking

          Max Laverse added a comment - Apparently this credential type comes from https://github.com/jenkinsci/kubernetes-cd-plugin . What did you mean with "I find confused how to use a kubeconfig credentials in general. I was following this doc https://wiki.jenkins.io/display/JENKINS/Kubernetes+Cli+Plugin that used its own credentials type." ? It was from another page right ? Because I only listed the supported plugins here, and credentials from kubernetes-cd-plugin are not part of it. But I might have put a broken link somewhere, just checking

          I think I saw quickly this image
          https://github.com/jenkinsci/kubernetes-cli-plugin/blob/master/img/webui.png and I associate to credentials of kubernetes-cd-plugin. My fault, reading again the doc all is clear.

          Ruben Fernandez added a comment - I think I saw quickly this image https://github.com/jenkinsci/kubernetes-cli-plugin/blob/master/img/webui.png and I associate to credentials of kubernetes-cd-plugin. My fault, reading again the doc all is clear.

          Max Laverse added a comment -

          ok great, thanks

          Max Laverse added a comment - ok great, thanks

            max_laverse Max Laverse
            rubick Ruben Fernandez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: