0

I'm trying to use Jenkins Kubernetes CLI plugin from https://plugins.jenkins.io/kubernetes-cli/ to let deploy artifacts from Jenkins to GKE cluster.

Expected Behavior

Get cluster info on kubectl cluster-info

Actual Behavior

Error out as Unable to connect to the server: x509: certificate signed by unknown authority

Steps to Reproduce the Problem

Output of generated ./kube/config

+ kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://xxx.xxx.xxx.yyy
  name: my-cluster
contexts:
- context:
    cluster: my-cluster
    user: jenkins-pipeline
  name: my-cluster-jenkins
current-context: my-cluster-jenkins
kind: Config
preferences: {}
users:
- name: jenkins-pipeline
  user:
    username: jenkins-pipelin

When I run from a command line I need to do

export GOOGLE_APPLICATION_CREDENTIALS=path/to/key.json

Where that part goes in that plugin?

1

Put it inside the sh?

withKubeConfig(...) {
  sh “””
    export ...
    kubectl ...
  “””
}
3
  • That will not work as by default plugin is working with user access with token not the key.json – JackTheKnife Feb 24 at 18:34
  • So when you run from command line with the export, subsequent kubectl (per plugin page) reads the contents of the file? – Chris F Feb 24 at 19:05
  • From the plugin page, you want to somehow use the contents of your key.json file for credentialsId? – Chris F Feb 24 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.