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

Only bind to IPv6 addresses when disableIPv6=false #12938

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

alpeb
Copy link
Member

@alpeb alpeb commented Aug 5, 2024

Problem

When the IPv6 stack in Linux is disabled, the proxy will crash at startup.

Repro

In a Linux machine, disable IPv6 networking through the net.ipv6.conf.* sysctl kernel tunables, and restart the system:

  • In /etc/sysctl.conf add:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
  • In /etc/default/grub set:
GRUB_CMDLINE_LINUX="ipv6.disable=1"
  • Don't forget to update grub before rebooting:
sudo update-grub

In a default k3d cluster, install Linkerd. You should see the following error in any proxy log:

thread 'main' panicked at /__w/linkerd2-proxy/linkerd2-proxy/linkerd/app/src/lib.rs:245:14:
Failed to bind inbound listener: Os { code: 97, kind: Uncategorized, message: "Address family not supported by protocol" }

Cause

Even if a k8s cluster didn't support IPv6, we were counting on the nodes having an IPv6 stack, which allowed us to bind to the inbound proxy to [::] (although not to [::1] for the outbound proxy, as seen in GKE). This was the case in the major cloud providers we tested, but it turns out there are folks running nodes with IPv6 disabled and so we have to cater that case as well.

Fix

The current change undoes some of the changes from 7cbe2f5 (for the proxy config), 7cbe2f5 (for the policy controller) and 6603409 (for linkerd-cni), binding back again to 0.0.0.0 unless disableIPv6 is false.

## Problem

When the IPv6 stack in Linux is disabled, the proxy will crash at startup.

## Repro

In a Linux machine, disable IPv6 networking through the `net.ipv6.conf.*` sysctl kernel tunables, and restart the system:

- In /etc/sysctl.conf add:
```
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
```

- In /etc/default/grub set:
```
GRUB_CMDLINE_LINUX="ipv6.disable=1"
```

Don't forget to update grub before rebooting:
```
sudo update-grub
```

In a default k3d cluster, install Linkerd. You should see the following error in any proxy log:

```
thread 'main' panicked at /__w/linkerd2-proxy/linkerd2-proxy/linkerd/app/src/lib.rs:245:14:
Failed to bind inbound listener: Os { code: 97, kind: Uncategorized, message: "Address family not supported by protocol" }
```

## Cause

Even if a k8s cluster didn't support IPv6, we were counting on the nodes having an IPv6 stack, which allowed us to bind to the inbound proxy to [::] (although not to [::1] for the outbound proxy, as seen in GKE). This was the case in the major cloud providers we tested, but it turns out there are folks running nodes with IPv6 disabled and so we have to cater that case as well.

## Fix

The current change undoes some of the changes from 7cbe2f5 (for the proxy config), 7cbe2f5 (for the policy controller) and 6603409 (for linkerd-cni), binding back again to 0.0.0.0 unless `disableIPv6` is false.
@alpeb alpeb requested a review from a team as a code owner August 5, 2024 17:22
@alpeb alpeb merged commit 332c4ef into main Aug 5, 2024
40 checks passed
@alpeb alpeb deleted the alpeb/ipv6-disabled-fixup branch August 5, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants