-
Notifications
You must be signed in to change notification settings - Fork 17
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
Use in k3s alongside normal OCI images #136
Comments
I found this in A possible way to hack this together would be container (not pod) annotations and then patching this part of containerd: |
plugins."io.containerd.grpc.v1.cri".containerd = {
snapshotter = "nix";
image-service-endpoint = "unix:///run/nix-snapshotter/nix-snapshotter.sock";
disable_snapshot_annotations = false;
};
plugins."io.containerd.transfer.v1.local".unpack_config = [
{
platform = "${GOOS}/${GOARCH}";
snapshotter = "nix";
}
];
proxy_plugins.nix = {
type = "snapshot";
address = "/run/nix-snapshotter/nix-snapshotter.sock";
}; Even with that config I cannot seem to get
Which is also exactly what I get with the |
I'm on a wild debugging streak right now, sorry for detracting this issue but I can't make heads or tails of this. The |
|
Yes nix-snapshotter is backwards compatible, so you should be able to resolve and run regular OCI images and nix-snapshotter images in the same pod. The same image can also have interleaved regular OCI layers & nix-snapshotter layers. For the server-side, we just configure the kubelet directly via: Note that Kubernetes doesn't need to know about nix-snapshotter other than it being an CRI image service. When the kubelet eventually asks containerd to spawn a container, containerd knows which snapshotter to use based on Using
Note that rootless k3s doesn't support nix-snapshotter yet: #120, but rootful k3s is working.
Do you have the nix CLI available in the PATH for the nix-snapshotter process?
It would help to have some kind of reproduction case, it seems like there's many moving pieces while you're making it fit with NixNG. |
Yes,
There is way too many part moving yes, its hard for me to produce a reproducible example. I am trying to find something in the logs, pointing me to the bit i missed. But so far im having no luck. It's as if the
I'm running rootful, always have been. The problem seems to have arisen when I added nix-snapshotter to an existing containerd and k3s. Both of the links you've provided I've already incorporated. And I've verified in the logs that both |
Make sure you’re using this containerd: https://github.com/pdtpartners/nix-snapshotter/blob/main/modules/flake/overlays.nix#L8. If you aren’t seeing mounts, it must be having trouble either:
If you could provide a gist with containerd, nix-snapshotter logs, as well as “kubectl describe pod xyz”, that’ll help as well. |
Ah, I'm using the internal k3s containerd, could that be the culprit? I'll provide the logs later today |
Oh and after I am done, I'll start a draft of the manual install doc, at least for the k3s rootful situation. |
I found the bug. I wasn't using the package = mkPackageOption pkgs "k3s" {}; as to why it fails, is beyond me. Going through EDIT: fixed, I have a weird thing how I pass through options from a NixOS module to the underlying NixNG module. I just copied the option definition which proceeded to use the On a side note, I am working on a NixOS module, which inside a |
Yes that makes sense. Sorry I should’ve been more clear, rootless only doesn’t work because it can only use its embedded containerd, I.e. rootful only works with external containerd. This repo provides overlays for both containerd & k3s so embedded & external all work, but we’re still working on upstreaming these bug fixes. |
yeah, I got it. I think the take away here is that I need to help with the manual install doc :) and that once you get this running, you CANNOT switch or play in any way shape or form with the snapshotters. I had to reset the state of containerd multiple times. If it was throwing weird errors, I reset it. While we're here, would there be any interest in the NixNG code? As the author, I would be very happy if I found someone who had an interest in it. I stand behind the fact that distroless is nice, until it isn't. In my experience most things do not work and NixNG is as distroless as it can be. And thanks for the help, I'll finalize my modules and then draft the docs for this little journey :) |
As nix-snapshotter stabilizes, I’m moving in the direction of upstreaming NixOS modules, Home Manager modules, etc. This repo is only incubating the changes, so overlays won’t be necessary later. So I rather the NixNG repo be the source of truth for nix-snapshotter NixNG modules. If you can provide reproduction for snapshotter instability, happy to take a look. |
I've managed to pull apart this flake and make it fit into NixNG and the rest. I have figured out that
makes normal OCI images work in kubernetes, while
makes
nix:0/nix/store/...
image refs work. Is it possible to have both work at the same time inside onekubelet
?I know that on the command line I can specify
--snapshotter
orCONTAINERD_SNAPSHOTTER
and set them tonix
which will again make nix native containers work, but I'm not sure how to specify that in kubernetes.The text was updated successfully, but these errors were encountered: