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

k3s example: error pulling image #102

Closed
antoinerg opened this issue Oct 16, 2023 · 6 comments · Fixed by #110
Closed

k3s example: error pulling image #102

antoinerg opened this issue Oct 16, 2023 · 6 comments · Fixed by #110

Comments

@antoinerg
Copy link
Contributor

antoinerg commented Oct 16, 2023

First of all, thanks for the great project! I've always wanted K8S to be declarative all the way down to container images. This is awesome!

I tried running the examples on k3s by commenting out ./kubernetes.nix in favor of ./k3s.nix in the following file:

./kubernetes.nix
# ./k3s.nix

then ran nix run ".#vm" to get a VM.

Although it successfully boots a VM with k3s, I hit an error when pulling a Nix image like the preloaded one (eg. kubectl apply -Rf /etc/kubernetes/redis will result in a pod that fails with a pull image error).

Doing the same steps as above but using ./kubernetes.nix works flawlessly.

@antoinerg antoinerg changed the title k3s example not pulling image k3s example: error pulling image Oct 16, 2023
@antoinerg
Copy link
Contributor Author

I think the reason why this was failing is because we need to use a k3s version that includes the changes that closed issue k3s-io/k3s#8480

@antoinerg antoinerg reopened this Jan 7, 2024
@antoinerg
Copy link
Contributor Author

I think the reason why this was failing is because we need to use a k3s version that includes the changes that closed issue k3s-io/k3s#8480

... and we then need to point k3s's kubelet to use nix-snapshotter image service:

services.k3s = {
  enable = true;
  configPath = pkgs.writeText "k3s_config.yaml" ''
    container-runtime-endpoint: "unix:///run/containerd/containerd.sock"
    image-service-endpoint: "unix:///run/nix-snapshotter/nix-snapshotter.sock"
  '';
};

@antoinerg
Copy link
Contributor Author

antoinerg commented Jan 12, 2024

Along with #102 (comment), the fix from #107 is required!

@antoinerg
Copy link
Contributor Author

Along with #102 (comment), the fix from #107 is required!

The fix landed so I can now follow-up with a PR with the changes from #102 (comment) 🎉

@antoinerg
Copy link
Contributor Author

The image-service-endpoint flag was added to k3s in patch release 1.27.7 (reference: k3s-io/k3s#8481). Unfortunately, nixpkgs/nixos-23.11 uses v1.27.6.

@RobbieBuxton
Copy link
Collaborator

The image-service-endpoint flag was added to k3s in patch release 1.27.7 (reference: k3s-io/k3s#8481). Unfortunately, nixpkgs/nixos-23.11 uses v1.27.6.

We could patch it with an overlay until we decide to move onto the next stable Nixos release in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants