Running minikube cluster as jenkins agent

I have a container instance: jenkins, and kubernetes cluster: minikube both running on my local machine. I can’t figure out a way to integrate minikube in jenkins. Below is how i set things up.

Setup Minikube
    - minikube start
    - replace cert and key values in .kube/config with hardcoded data

Setup Jenkins 
    - docker run --name jenkins -v jenkins_home:/var/jenkins_home -d -p 8080:8080 -p 50000:50000 --network minikube jenkins/jenkins:lts

Integrate Kubernetes in Jenkins 
    - install kubernetes plugin 
    - configure cloud -> add a new cloud -> kubernetes -> kubernetes cloud details  
        - create credential: secret file, use the file with .kube/config
        - click test connection -> Error testing connection : Failed to connect to /{port}

I’ve been stuck with this problem for a few good days and it’s driving me insane. My jenkins instance is already running in the same network with the minikube.

each container will have its own ip, and its own localhost, so means the jenkins container, not the k8s controller. You’ll probably want to use the external ip.

I don’t know if there’s a dynamic way of getting it. I’ve always had a static ip for my k8s controller. is actually the ip im getting from ‘‘kubectl cluster-info’’ that’s why i’m certain it’s from k8s

yea, normally means localhost, as in “this computer”
inside a docker container though, means this container
So unless you are running kubernetes inside of the jenkins container (or not using a jenkins container), isn’t right.

The error message is clearly saying it can’t connect to port 58711