Open jamescostian opened 5 years ago
Just read the options part of the manual more closely, and fixed one part of my configuration:
networking.bridges = {
- cbr0.interfaces = [];
+ cbr0 = {
+ interfaces = [ "wlo0" ];
+ };
};
That allows my normal internet access to work, but prevents docker and kubernetes from starting. Here are my journalctl -xe
logs.
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
still relevant
Any updates on this?
Using --net=host
is not a proper solution at all, the root cause should be figured out instead. Enabling k8s service breaks networking completely inside Docker and containers set up by k8s can't access the internet either.
Edit: Turns out flannel
broke before, making k8s containers' network nonfunctional.
I've tried with firewall on/off, ensured that net.ipv4.ip_forward and net.ipv4.conf.<intf>
.forwarding are set to 1.
This happens in 20.03
- system: `"x86_64-linux"`
- host os: `Linux 5.4.47-xanmod1, NixOS, 20.03.2310.fb6c3a6831c (Markhor)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.6`
- channels(root): `"nixos-20.03.2310.fb6c3a6831c, nixpkgs-unstable-20.09pre228384.c27e54de99d"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
... and unstable
- system: `"x86_64-linux"`
- host os: `Linux 5.4.47, NixOS, 20.09pre231796.22a81aa5fc1 (Nightingale)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.6`
- channels(root): `"nixos-20.09pre231796.22a81aa5fc1"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
I marked this as stale due to inactivity. → More info
Still important to me
One solution is to make Kubernetes use CRI-O instead of Docker. However, it's not very straightforward, but that's what I ended up doing.
Might try finding time to clean up my Nix files...
Huh, in that case I'll say this is related to https://github.com/NixOS/nixpkgs/pull/96084
@mikroskeem When possible, would you mind sharing the relevant part of your config, even if messy? I've got CRI-O working via the PR linked above but still no networking :-/
There you go - https://gist.github.com/mikroskeem/683926a55c5b65d9343b9397ccc09afa.
Here are few notes and warnings:
1) I copied the files from nixpkgs and made changes directly - pick last commit before 1 Jul 2020 and run diff
; There might be some comments beginning with zentria:
, search for them too.
2) Anything what touches networking/firewall probably bricks flannel. Solution: reboot.
3) You must reset your existing k8s setup - don't also forget etcd
and so on. Do not bother draining the node.
4) Something in the networking part is broken, at some point 50% of the connections just time out (over a week of uptime or so - pretty much every Monday debugging/headache/dumpster fire/reboot cycle)
In conclusion: if something breaks, good old "have you tried turning it off and on again" practice applies.
Thank you @mikroskeem!
I marked this as stale due to inactivity. → More info
Describe the bug I set up k8s and docker, and noticed that when running in a docker container, I could not connect to the internet. If I set
--net=host
fordocker run
or--network=host
fordocker build
, then I can access the internet within containers. When I disabled k8s, accessing the internet from docker worked without any extra configuration. It is worth noting that thedocker0
interface appears in ifconfig when k8s is disabled, but not when k8s is enabled, however, this appears to be on purpose.To Reproduce In
configuration.nix
you need to have docker and k8s:Then
nixos-rebuild switch
and runsudo docker run -it --rm debian /usr/bin/ping 1.1.1.1
and you will seeconnect: Network is unreachable
Expected behavior I expect kubernetes and docker to both work when they are both enabled
Additional context I tried
export DOCKER_OPTS="--net=host"
but it didn't fix things. I also looked through all the relevant GitHub issues and the online manual, none helped. Google wasn't helpful either. The best I could find was a slide shown in a youtube video, which seemed to acknowledge the lack of a bridge interface for docker. Its config was outdated, so I tried updating it like so:Unfortunately, this did not fix docker (in fact, it broke my normal internet connection until I rolled back)
Metadata