I want to create a CI/CD pipeline using Jenkins wherein I want to add a K8s master node as a slave to my Jenkins master setup. My question is is it a good idea? I am planning to create a username Jenkins on one of the masters, copy the kubeconfig to the user, connect the master to this node and then run all the Kubernetes deployments from this node.
Is there a better way to do this?
Sure, why not. If you are looking at running tests that don't require a production like system, I'd recommend using something like minikube on your Jenkins slave.
Make sure that minikube is configured as the jenkins
user and also make sure you don't have any other standalone Kubernetes component (kube-proxy, kube-apiserver, kube-controller-manager, etc) on your server that might conflict with the minikube installation.