Is this possible for create slave with K8S plugin without setting Jenkins on cluster?

5/30/2019

I'm trying to configure K8s plugin on Jenkins to automatically create slave agent whenever a job is triggered. However, as far as I researched, it is only possible to do so providing that Jenkins server is running on k8s cluster. Is there a way to configure k8s plugin on Jenkins server which is running on Openstack server?

I've a Jenkins server and also configured k8s plugin on it. Everytime I build a new job, a new pod for slave agent is created but not possible to be started. When i tried command kubectl logs <pod-name> I received the following error:

Error from server: Get https://XX.XX.XX.XX:10250/containerLogs/jenkins/slave-tester-4c4wb/jnlp: net/http: TLS handshake timeout
-- Phạm Nhật Minh
jenkins
kubernetes

1 Answer

5/30/2019

This is definitely possible, there is a good amount of documentation available here: https://github.com/jenkinsci/kubernetes-plugin#kubernetes-cloud-configuration

The important part is: "When running the Jenkins master outside of Kubernetes you will need to set the credential to secret text. The value of the credential will be the token of the service account you created for Jenkins in the cluster the agents will run on."

-- gavsyuk
Source: StackOverflow