Copying the Rancher cluster’s “KubeConfig” file into the Jenkins server using Rancher or VScode

We can use it; If Jenkins Pipeline is unable to copy the “KubeConfig” file to Jenkins or if we need to be able to connect from any computer to our remote Kubernetes cluster.

Cumhur Akkaya
6 min readJul 28, 2023

Jenkins reads the required credentials from the ~/.kube/config file in order to connect to the Rancher. We did this ~/.kube/config procedure with script commands in the Jenkins Staging Pipeline project. If the script commands fail, we will manually copy “KubeConfig” file using VScode or Rancher. So, we can enable Jenkins to connect to Rancher in Jenkins Pipeline.

We will do it all step by step.

Topics we will cover:

Topics we will cover:

1. What is the kubeconfig file
2. Downloading the “.kube” folder to Jenkins using VScode
3. Copying the KubeConfig file to Jenkins using Rancher menus
4. As a result
5. References

1. What is the kubeconfig file

A kubeconfig file is a file used to conigure access to Kubernetes when used in…

--

--

Cumhur Akkaya

✦ Multi-Cloud & DevOps Engineer, ✦Technical Writer, ✦AWS Community Builder, ✦LinkedInTop Voice, ✦Believes in learning by doing, ✦ linkedin.com/in/cumhurakkaya