https://rancher.com/ logo
Title
i

incalculable-painting-771

11/21/2022, 11:34 PM
I am trying to create and rke cluster inside a dind docker image , I have reached a point where all cluster Components are created , but the network plugin fails And when i look at the network plugin pod logs , i see a time out when it tries to reach the node ip Any suggestions , is it even possible to create a full working Rke cluster inside a dind docker image
c

creamy-pencil-82913

11/21/2022, 11:36 PM
Do you need to use RKE? Have you tried k3s, or k3d?
i

incalculable-painting-771

11/21/2022, 11:37 PM
Did not use/try k3s / k3d , But should it work with k3s ?, is there a tutorial on how to create a full cluster inside a container?
c

creamy-pencil-82913

11/21/2022, 11:41 PM
go check it out, come back if you have any questions
đź‘Ť 1
i

incalculable-painting-771

11/22/2022, 11:41 AM
So I have been playing with k3d and k3s , and indeed k3d does start a k8s cluster in a docker container But I can't use k3d for my final goal. I am trying to create a dockerfile that will build a docker image that will install k3s , then apply my k8s app resources using kubectl and helm /helmfile Then take this docker image and run it on CI platform. That way i will save a lot of time deploying my k8s app resources , which take time. I have been looking and trying different k3s configuration but i get "can not find systemd or openrc to use as a process supervisor for k3s. I get this when i run k3s from inside a docker container that runs ubuntu: latest I run the k3s just as the documentation requires. Any idea what am i missing?
b

bulky-sunset-52084

11/22/2022, 5:32 PM
"can not find systemd or openrc to use as a process supervisor for k3s.
Are you using
systemctl enable/start
to try to start k3s because you shouldn't. Make sure to execute the binary directly in server mode.
That way i will save a lot of time deploying my k8s app resources , which take time.
I'm trying to understand what the point of kubernetes is at all when you do this. All the apps are isolated to one node so you have no HA. You are managing your own containers and images not Kubernetes. I personally don't think adding in the additional complexity of kubernetes is helping at all in your case here and think you'd be better off just deploying the apps directly in containers and if you want to manage those apps down the line then look into k8s.
c

creamy-pencil-82913

11/22/2022, 6:06 PM
You’re not supposed to install k3s in a docker container. You’re supposed to use the rancher/k3s docker image to run it.
If you want stuff deployed automatically, you can place additional files in /var/lib/rancher/k3s/server/manifests and they will be applied to the cluster when it starts.
You could do this by building a custom image
FROM rancher/k3s
and adding the files, or just by mounting the files in as a volume when you run the container
i

incalculable-painting-771

11/22/2022, 6:10 PM
@bulky-sunset-52084 I want the CI to use k8s because we use it in production , also we have an internal tool that deploys the application parts in stages and that tool needs k8s. So why manage in another way when I have every thing ready for k8s.
@creamy-pencil-82913 Hmm , if i do that , It seems like automatic app deployment , but not a ready to go cluster in a docker image, like this will not really save time. But i have been trying different stuff all day , and i managed to run k3d create cluster inside docker:dind official image. The cluster is created but i did not test it further
c

creamy-pencil-82913

11/22/2022, 6:27 PM
yeah don’t do that.
Use rancher/k3s, or run k3d on a normal host. If you start mucking around with dind you’re just making a hash of things
i

incalculable-painting-771

11/22/2022, 6:32 PM
Yeah I am just surprised it worked , and I am not fully sure that I should that.