How to get kubernete's configuration from rancher 2.0?

2/11/2019

I have rancher 2.0 to manage kubernetes using RBAC access control, the kubeconfig I used for kubectl is simple, it shows the cluster server to rancher.

Then in some system like jenkins kubernetes plugin, how can I fill the information for kubernetes Name, Kubernetes URL, Kubernetes server certificate key, ...

see below

enter image description here

-- Larry Cai
jenkins
jenkins-kubernetes
rancher

1 Answer

5/24/2019
  1. Access rancher and create an API key (save the access key and secret key)
  2. Access rancher, cluster, click on the kubectl link on the top right
  3. Within kubectl run the command cat ~/.kube/config (notice the certificate-authority file and notice the server)
  4. Run command cat /nonexistent/ssl/ca.cert (and save the certificate)

  5. On Jenkins (fill in the following) Kubernetes URL = [put the server in here] Kubernetes server certificate key = [put cert in here] Credential, click Add, create a username/password credential, use access key as username and secret key as password.

  6. Click on Test connection

-- Den
Source: StackOverflow