Expose rootless state dir under ~/.rancher/k3s/rootless#9308
Expose rootless state dir under ~/.rancher/k3s/rootless#9308brandond merged 1 commit intok3s-io:masterfrom
Conversation
Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
d6085fe to
a7c8186
Compare
|
It's been a while since I poked at this, but I believe that the state dir is intentionally an unlinked tempdir, because no state should be retained when rootless k3s exits. When it is done, the ephemeral namespace that k3s is running in is cleaned up, and all the child processes are killed, so leaving that around for the next invocation would be incorrect. Is there some other way to accomplish what you're trying to do, that doesn't involve leaving the state around afterwards? If you're just trying to use nsenter to interact with rootless k3s, there are some examples at #8512 (comment) |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #9308 +/- ##
==========================================
- Coverage 49.07% 40.54% -8.54%
==========================================
Files 154 154
Lines 16416 16551 +135
==========================================
- Hits 8056 6710 -1346
- Misses 7090 8693 +1603
+ Partials 1270 1148 -122
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Can we simply just |
|
Maybe just change those paths to be outside a mount namespace'd path when running rootless? then you wouldn't have to nsenter at all to get at them. |
|
There seems to be a bit of overlap in goals between #9309 and this PR, do you think it'd be worthwhile to just make all the changes in a single PR? We'll also need an issue describing what the current problems are that you're solving with this PR. |
I believe
Happy to move them in the same PR, they do have different goals though. #9309 is for end-users to seamlessly use the rootless containerd embedded in k3s along with rootless k3s (for parity with rootful k3s + containerd), whereas this is for debugging rootless k3s (my main use case) or building tools around rootless k3s. |
Proposed Changes
Currently, the
~/.rancher/k3s/rootlessdirectory is created but is unused. The directory is passed to thecreateParentOptsbut the variable is then overrided by a call toos.MkdirTemp. This makes it harder tonsentervia rootlesskit'schild_pidor hit the rootlesskit's API socket.Types of Changes
~/.rancher/k3s/rootlessVerification
~/.rancher/k3s/rootlessLinked Issues
nsenterrootless k3s to interact with namespaced sockets and filesystems #9449User-Facing Change