How to import k3d cluster into local rancher #689
-
I have the scenario where I want to import the local k3s cluster (started with k3d) into a rancher which is running in localhost as well. How can I import the existing cluster into rancher? What I tried # start cluster
k3d cluster create mycluster
# wait until everything is up and completed
watch kubectl get pods --all-namespaces
# add rancher to the k3s cluster network with the idea to access it from the k3s agent node
docker run --rm --privileged --name rancher-local --network k3d-mycluster -d -p 80:80 -p 443:443 rancher/rancher:v2.5.9
The problem is now the rancher agent pod on the k3s agent node cannot resolve Best regards, Manuel |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @mavogel , thanks for starting this discussion! So let me see if I got that correctly: You have a k3d cluster and a Rancher container in the same docker network. If that's correct, then you can patch the CoreDNS configmap in the cluster to include the address of the That should (could) do the trick 👍 |
Beta Was this translation helpful? Give feedback.
Hi @mavogel , thanks for starting this discussion!
I just got back from vacation, so sorry for the late reply..
So let me see if I got that correctly:
You have a k3d cluster and a Rancher container in the same docker network.
You're deploying the Rancher Agent pods in k3d, but they cannot resolve the name of the Rancher Server container running outside of the cluster.
If that's correct, then you can patch the CoreDNS configmap in the cluster to include the address of the
rancher-local
container.Check it out via
kubectl edit configmap coredns -n kube-system
and you'll see similar entries e.g. forNodeHosts
.That should (could) do the trick 👍