Skip to content

kubeadm init failing for IPv6-only configuration #1212

@neolit123

Description

@neolit123

reported by @leblancd here:
kubernetes/kubernetes#70617


What happened:
If you run 'kubeadm init ...' with an IPv6-only configuration, kubeadm will keep hanging and timing out here:

[init] waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests"

Looking at the state of kubernetes system pods, both etcd and API controller pods are crashing.
Looking at the etcd server docker container logs, you'll find:

invalid value "https://fd00:20::2:2379" for flag -advertise-client-urls: URL address does not have the form "host:port": https://fd00:20::2:2379
. . .

The issue here is that the URL used for '--advertise-client-urls' needs square brackets around the IP address iff that IP address is IPv6, i.e. the URL should be "https://[fd00:20::2]:2379.

Inspecting the kubeadm code, the problem appears to be here:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/etcd/local.go#L145-L147

   "advertise-client-urls":       fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenClientPort),
   "listen-peer-urls":            fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort),
   "initial-advertise-peer-urls": fmt.Sprintf("https://%s:%d", cfg.APIEndpoint.AdvertiseAddress, kubeadmconstants.EtcdListenPeerPort),

There are other "IPv4-isms" in this script, just search for "%s:%d".

What you expected to happen:
IPv6 magic.

How to reproduce it (as minimally and precisely as possible):
(1) git clone latest k8s master: https://github.com/kubernetes/kubernetes
(2) git clone https://github.com/kubernetes-sigs/kubeadm-dind-cluster
(2) Use Kubeadm-DinD-Cluster (K-D-C) scripts to bring up an IPv6-only cluster:

cd $GOPATH/src/k8s.io/kubernetes
make clean
export IP_MODE=ipv6
export BUILD_KUBEADM=y
export BUILD_HYPERKUBE=y
export REMOTE_DNS64_V4SERVER=<your-local-DNS-server-if-necessary>
$HOME/kubeadm-dind-cluster/dind-cluster.sh up

Anything else we need to know?:
Looks like the code in local.go that is described above was changed with PR #69486

Environment:

  • Kubernetes version (use kubectl version): Latest, it's build with K-D-C scripts above
  • Cloud provider or hardware configuration: Any Linux server, just use K-D-C
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ecosystemhelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.priority/awaiting-more-evidenceLowest priority. Possibly useful, but not yet enough support to actually get it done.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions