Change:
/kind bug What happened: Currently, if the user sets the cidr with --pod-network-cidr with kubeadm, the kube-controller-manager is passed the cidr with the --cluster-cidr arg. --node-cidr-mask-size is not passed to the kube-controller-manager and the controller-manager used the default value of 24 The default value of 24 if good for IPv4, but for IPv6 the controller-manager throws an error because the node-cidr-mask-size is incorrect. What you expected to happen: The user should be able to specify the node-cidr-mask-size for IPv6 How to reproduce it (as minimally and precisely as possible): Use Kubeadm specify an IPv6 address with --pod-network-cidr. with a subnet greater than 24. For example kubeadm init --pod-network-cidr=2001:101::0/64 Anything else we need to know?: Environment: IPv6 Kubernetes version (use ): Cloud provider or hardware configuration**: OS (e.g. from /etc/os-release): Kernel (e.g. ): Install tools: Others:
There are no sig labels on this issue. Please by: a sig: e.g., to notify the contributor experience sig, OR the label manually: e.g., to apply the label Note: Method 1 will trigger an email to the group. You can find the group list and label list . The in the method 1 has to be replaced with one of these: bugs, feature-requests, pr-reviews, test-failures, proposals
/area ipv6 /area kubeadm
/assign rpothier

Discussion:
import ( "fmt" <ins> "net" </ins> "os" "path/filepath" "strings"

// Let the controller-manager allocate Node CIDRs for the Pod network. // Each node will get a subspace of the address CIDR provided with --pod-network-cidr. if cfg.Networking.PodSubnet != "" { <del> command = append(command, "--allocate-node-cidrs=true", "--cluster-cidr="+cfg.Networking.PodSubnet) </del> <ins> maskSize := "24" if ip, _, err := net.ParseCIDR(cfg.Networking.PodSubnet); err == nil { if ip.To4() == nil { maskSize = "64" } } command = append(command, "--allocate-node-cidrs=true", "--cluster-cidr="+cfg.Networking.PodSubnet, "--node-cidr-mask-size="+maskSize) </ins> } return command }

}, { cfg: &kubeadmapi.MasterConfiguration{ <del> Networking:        kubeadmapi.Networking{PodSubnet: "bar"}, </del> <ins> Networking:        kubeadmapi.Networking{PodSubnet: "10.0.1.15/16"}, </ins> CertificatesDir:   testCertsDir, KubernetesVersion: "v1.7.0", },

"--use-service-account-credentials=true", "--controllers=*,bootstrapsigner,tokencleaner", "--allocate-node-cidrs=true", <del> "--cluster-cidr=bar", </del> <ins> "--cluster-cidr=10.0.1.15/16", "--node-cidr-mask-size=24", }, }, { cfg: &kubeadmapi.MasterConfiguration{ Networking:        kubeadmapi.Networking{PodSubnet: "2001:101:115::/48"}, CertificatesDir:   testCertsDir, KubernetesVersion: "v1.7.0", }, expected: []string{ "kube-controller-manager", "--address=127.0.0.1", "--leader-elect=true", "--kubeconfig=" + kubeadmconstants.KubernetesDir + "/controller-manager.conf", "--root-ca-file=" + testCertsDir + "/ca.crt", "--service-account-private-key-file=" + testCertsDir + "/sa.key", "--cluster-signing-cert-file=" + testCertsDir + "/ca.crt", "--cluster-signing-key-file=" + testCertsDir + "/ca.key", "--use-service-account-credentials=true", "--controllers=*,bootstrapsigner,tokencleaner", "--allocate-node-cidrs=true", "--cluster-cidr=2001:101:115::/48", "--node-cidr-mask-size=64", </ins> }, }, }