I am a beginner to devops and right now I'm learning jenkins. I have a kind cluster on my local machine and jenkins running inside a docker container at http://localhost:8000. I wish to execute the kubernetes commands liek 'kubectl get pods' in the cluster using my jenkins pipeline.

The motive of doing this is to automate various steps in setting up a blockchain network using hlf operator. But I've found it very difficult to connect my jenkins to kubernetes.

Things I have tried so far :

  1. I did try to upload the kubeconfig as a secret while adding a new cloud in jenkins. Still I get the following error .

enter image description here

I would appreciate any help regarding the same.

Some additional questions :

  1. Is there a better tool suited for running kubernetes command ?

1 Answer 1


My approach would be to run the Jenkins container inside the k8s cluster (Kind in your case) in a pod (through a Deployment). You would then give permissions to the deployment using ClusterRole, ClusterRoleBinding and ServiceAccount to execute the commands you wish Jenkins to execute.

Don't forget to set Quotas on your Jenkins pods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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