kubeadm: use correct IP family for etcd localhost
kubeadm always use the IPv4 localhost address by defaultA for etcd The probe hostname is obtained before the generation of the etcd parameters, so it can't detect the right IP familiy for the host of the probe. This causes that with IPv6 clusters doesn't work because the probe uses the IPv4 localhost address. This patchs configures the right localhost address based on the used AdvertiseAddress IP family.
This commit is contained in:
@@ -269,8 +269,11 @@ func GetSchedulerProbeAddress(cfg *kubeadmapi.ClusterConfiguration) string {
|
||||
// GetEtcdProbeEndpoint takes a kubeadm Etcd configuration object and attempts to parse
|
||||
// the first URL in the listen-metrics-urls argument, returning an etcd probe hostname,
|
||||
// port and scheme
|
||||
func GetEtcdProbeEndpoint(cfg *kubeadmapi.Etcd) (string, int, v1.URIScheme) {
|
||||
func GetEtcdProbeEndpoint(cfg *kubeadmapi.Etcd, isIPv6 bool) (string, int, v1.URIScheme) {
|
||||
localhost := "127.0.0.1"
|
||||
if isIPv6 {
|
||||
localhost = "::1"
|
||||
}
|
||||
if cfg.Local == nil || cfg.Local.ExtraArgs == nil {
|
||||
return localhost, kubeadmconstants.EtcdMetricsPort, v1.URISchemeHTTP
|
||||
}
|
||||
|
Reference in New Issue
Block a user