Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Fix gRPC issue in IPv6 only cluster#83

Open
maxgoffart wants to merge 2 commits intonetworkop:masterfrom
maxgoffart:fix_grpc_ipv6
Open

Fix gRPC issue in IPv6 only cluster#83
maxgoffart wants to merge 2 commits intonetworkop:masterfrom
maxgoffart:fix_grpc_ipv6

Conversation

@maxgoffart
Copy link
Copy Markdown

Hi,

This PR fixes an issue encountered with gRPC in an IPv6 only clusters.

Current implementation

The current implementation is using fmt.Sprintf to combine the hostname and port number used when calling grpc.Dial(...). See daemon/grpcwire/grpcwire.go for instance.

Yet, this yields the following (important part highlighted) when doing kubectl describe pod/<podName>:

Warning FailedCreatePodSandBox 10m kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "ae67dda14b109f585fd51fdde5f54087955ae7b5f91d563957dbbe85a72ce021": plugin type="meshnet" name="meshnet" failed (add): rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: address fc00:f853:ccd:e793::4:51111: too many colons in address"

Fix

The solution is to use Go's net.JoinHostPort(...) instead of fmt.Sprintf to combine the hostname and port number.

This method will automatically add [] around the hostname when it's an IPv6, which is using :.

See grpc-go issue 3399 for more details.

Test

The fix has been tested on the following:

  • kind version => kind v0.20.0 go1.21.4 linux/amd64
  • Docker engine 25.0.3
  • Ubuntu 22.04 LTS
  • Kind cluster configuration:
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
networking:
  ipFamily: ipv6
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
kubeadmConfigPatches:
- |
  apiVersion: kubelet.config.k8s.io/v1beta1
  kind: KubeletConfiguration
  metadata:
    name: config
  maxPods: 253

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant