The following shows how to setup Kind locally with multiple nodes and connect to it from a remote computer.
WARNING: DO NOT DO THIS UNLESS YOU KNOW AHT YOU ARE DOING. OR UNLESS YOU ARE IN A SUBNET. KIND HAS VERY LITTLE SECURITY AND EXPOSING IT TO OUTSIDE MAY COMPROMISE YOUR SYSTEM!
- Install Kind in the local computer. Lets assume the ip of the local computer is
a.b.c.d
and you want the kubernetes control plane to run on port4321
. - Lets further suppose you want a kind deployment with 1 master node and 3 worker node. Some of this is taken from kubernetes-sigs/kind#873 (comment) .
- Make a file
kind_node_config
and paste the following in it
This is the configuration to create 3 workers, 1 master. This will expose the kubernetes api server to run on# four node (three workers) cluster config kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 networking: apiServerAddress: a.b.c.d apiServerPort: 4321 serviceSubnet: 10.0.0.0/16 nodes: - role: control-plane - role: worker - role: worker - role: worker
a.b.c.d:4321
, which for kind, normally always is configured to run in server127.0.0.1
and hence remote connection is not possible usually. - The do :
kind create cluster --config kind_worker
- This will create the kind cluster.
Creating cluster "kind" ... β Ensuring node image (kindest/node:v1.19.1) πΌ β Preparing nodes π¦ π¦ π¦ π¦ β Writing configuration π β Starting control-plane πΉοΈ β Installing CNI π β Installing StorageClass πΎ β Joining worker nodes π Set kubectl context to "kind-kind" You can now use your cluster with: kubectl cluster-info --context kind-kind Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community π
- Check your cluster infor by :
kubectl cluster-info
Kubernetes control plane is running at https://a.b.c.d:4321 KubeDNS is running at https://a.b.c.d:4321/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
- Basically you would have to copy over the
kube config
yaml file from the local computer to the remote. - From the remote computer, assuming you have ssh access do the following:
cd ~ mkdir .kube cd .kube scp <username>@a.b.c.d:4321:~/.kube/config ./
- Do
kubectl cluster-info
to verify you can connect to the kind cluster from the remote computer.Kubernetes control plane is running at https://a.b.c.d:4321 KubeDNS is running at https://a.b.c.d:4321/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy