-
Notifications
You must be signed in to change notification settings - Fork 40k
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
kube-proxy
's --healthz-bind-address
should support IPv4 and IPv6 simultaneously (dual stack)
#125055
Comments
/sig network |
How does kube-apiserver work for headlthz-bind-address? I think if it defaults to "0.0.0.0:10256", we can access to the service with ipv4 or ipv6 address.
|
Just FYI, I tested to "scope" ipv6 localhost with |
@sanmai-NL we are planning to add v1alpha2 kube-proxy configuration which will accept a dual-stack CIDR pair of healthz and metrics addresses. (we are moving towards CIDR to allow users to provide the network instead of just address, healthz and metrics server will be exposed on nodesIPs which belong to that CIDR range) |
The wanted feature here seems to be to accept connects on tcp-server.go// Tcp server that binds to "lo"
package main
import (
"context"
"log"
"net"
"os"
"syscall"
)
func main() {
if len(os.Args) < 2 {
log.Fatal("No address")
}
lconfig := net.ListenConfig{
Control: listenControl,
}
listener, err := lconfig.Listen(context.TODO(), "tcp", os.Args[1])
if err != nil {
log.Fatal(err)
}
defer listener.Close()
conn, err := listener.Accept()
if err != nil {
log.Fatal(err)
}
conn.Write([]byte("Bye...\n"))
defer conn.Close()
}
func listenControl(network, address string, c syscall.RawConn) error {
return c.Control(setIf)
}
func setIf(fd uintptr) {
if err := syscall.BindToDevice(int(fd), "lo"); err != nil {
log.Fatal(err)
}
}
As you can see, any address on |
Um, come to think of it, a device may be better than two addresses here. Unless the addresses are "any" or loopback, they must be different on all nodes. While this can be done, a common configmap makes it hard. An option might be something like: healthzBindAddress: "[::]:10256"
healthzBindInterface: "lo" |
|
Thanks for the pointer. Actually I think an interface may be better than a CIDR. Interfaces are more stable. It may be easier to guess the interface than the CIDR some infra-structure provider will use for nodes. |
But people can assign non-loopback addresses to a loopback interface and this would break. |
A network interface can be named variously depending on node OS config or hot-swapping NICs. They are less stable than, e.g., a pair of loopback CIDR blocks ::1/128,127.0.0.1/8. |
And CIDRs can change because of DHCP lease, or a new /64 segment for SLAAC. But, I agree with Dan that CIDRs are a more "more-kube-proxy-like approach". |
IPs will change because of the DHCP lease not CIDR, right? |
@uablrek For the use case I mentioned, CIDR subnets are stable. I think working with devices and supporting zone indexes in IPv6 addresses is interesting and potentially useful, but the requested functionality shouldn't be designed around that. |
@shaneutt: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/assign @danwinship |
/triage accepted |
I feel like we have danced around this area a bunch of times. Can we clarify what the real requirment is and implement it one time that we can use everywhere? E.g. write a k/utils library that offers "multi-listen" and takes a list of IPs and/or CIDRs, finds all matching local IPs, opens sockets on all of them and presents a facade of a single socket. |
The documentation is correct, just misleading. If you leave the value unset, then kube-proxy behaves as though you had said either |
I'm not sure anyone really cares a lot about listening on both In discussion on the v1alpha2 stuff, we decided the use case for overriding this is "I only want to serve health/metrics on the IP that faces the load balancer / prometheus / whatever". To match the way |
That pattern makes sense to me, but is a single family sufficient? IOW, does |
All of the following are valid combinations
but IIRC the plan is to allow users to configure it via v1alpha2 config, not via command line flags. |
Do we have a socketmux Go package already, or is thst something we'll invent? |
We can do that, we will need to listen on multiple IPs (technically 0.0.0.0/0 is a valid CIDR). That might be handy. Also would love to have your feedback on #121830 (comment) |
/area kube-proxy |
What would you like to be added?
The documentation suggests that the bind address is singular and that it's either of the IPv4 or IPv6 family. I think that's doubtful,
0.0.0.0
and::
also bind to both families inkube-apiserver
. Fix the docs (but see *) or fix the implementation.Why is this needed?
This artificial limitation makes it unpredictable where the healthz socket listens when running a dual-stack cluster.
*: It is particularly problematic and not fixable as a docs fix when the user wants to listen on loopback addresses for both families, since there's no notation for that, unlike 'all addresses' (0.0.0.0 and ::).
The text was updated successfully, but these errors were encountered: