Connect terraform to a remote server which runs minikube so to deploy kubernetes pods

I have set up a server in my office and run miniukube for the stagging Kubernetes environment. I’m trying to connect my local terraform with the server’s minikube cluster to deploy a single terraform file in the staging. But unfortunately, I couldn’t connect to my minikube cluster as my server IP is different from the minikube server IP.
Here are the methods of connecting the Kubernetes cluster, and I tried almost all of these but couldn’t get the connection.
I have used minikube stable release on x86-64 Linux using Debian package, and I want to use this cluster from my local terraform and the minikube cluster is installed in my server

https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/guides/getting-started
Thanks you

Hi @surajsah2053

If it was a Kubernetes cluster for a company you could certainly use Terraform Cloud Agents available in the enterprise tier.

For a development cluster, I suggest that you follow my tutorial “Kubernetes Cluster using Vagrant and Ansible with Containerd (in 3 minutes)”.

You can use any “normal” kubernetes command, plugin, provider (i.e. Terraform) to access the cluster or publish the IP to the outside world.

1 Like