Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RKE2 set containerd root and state directory different #6266

Closed
Davidffry opened this issue Jun 27, 2024 · 8 comments
Closed

RKE2 set containerd root and state directory different #6266

Davidffry opened this issue Jun 27, 2024 · 8 comments

Comments

@Davidffry
Copy link

Is your feature request related to a problem? Please describe.

The Issue is when I want to change the "defaults" directories path of root and state for the containerd I modify it into the config.toml.tmpl file (that I put into the directory */agent/etc/containerd/)

#extract of config.toml.tmpl
{{ template "base" . }}
root=/XYZ/
state=/dossofstate/

but when rke2 is started the containerd generate the config.toml correctly but the command of the containerd is :

ps -aux | grep -i containerd
...
containerd -c /kubernetes/agent/etc/containerd/config.toml -a /run/k3s/containerd/containerd.sock --state /run/k3s/containerd --root /kubernetes/agent/containerd
...

as you can see the command overwrite the configuration file (focus on the directory of state and root)

Describe the solution you'd like

Either in the config.yaml of Rke2 define the containerd_root_path and containerd_state_path
or generate generic path in the containerd config.toml and overwrite it.

Describe alternatives you've considered

No alternative

Additional context

Context in Airgapped mode but seems not relevant.

@brandond
Copy link
Member

brandond commented Jun 27, 2024

Can you describe your use case for changing the root and state dirs from the default set by k3s? I guess we could move to passing them via the config file instead of via the CLI, but I'm not sure what the original cause was for our passing them that way, so I'd be reluctant to make that change without good reason.

@tunicashashi
Copy link

Do I need to install k3s as well before running rke2 to get containerd in k3s/containerd/containerd.sock or can I use my own installed containerd?

@brandond
Copy link
Member

brandond commented Aug 9, 2024

You're welcome to provide your own container runtime, including your own standalone version of containerd. Just pass the socket address to rke2 via the --container-runtime-endpoint flag.

@Davidffry
Copy link
Author

Davidffry commented Aug 9, 2024 via email

@brandond
Copy link
Member

if I provide the socket you are sure that rancher does not use the default path?

Are you asking if the rke2 --container-runtime-endpoint flag works? Or if you can configure a standalone containerd can actually be configured to use custom paths? If it's standalone, you can manage the configuration however you want without having to use a template.

@lockwobr
Copy link

I would like this feature too. My use case is to make containerd use a different partition/disk. By setting these 2, it should be an easy way to add a second disk that is not the root partition and have all the containerd data live on that disk separate from root fs. I know I could mount a disk at /var/lib/rancher or something like that, but setting this seems like a better way to do this.

@brandond
Copy link
Member

brandond commented Sep 12, 2024

You can already set --data-dir if you don't want things under /var/lib/rancher/rke2.... why do you want to put containerd separate from the rest of rke2?

Copy link
Contributor

This repository uses a bot to automatically label issues which have not had any activity (commit/comment/label) for 45 days. This helps us manage the community issues better. If the issue is still relevant, please add a comment to the issue so the bot can remove the label and we know it is still valid. If it is no longer relevant (or possibly fixed in the latest release), the bot will automatically close the issue in 14 days. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants