mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
Fix: LocalApiEndpoint's bind-port uses controlPlane's port
Signed-off-by: pixiake <guofeng@yunify.com>
This commit is contained in:
parent
8618f03b34
commit
057aaead0c
|
|
@ -29,6 +29,7 @@ const (
|
|||
DefaultTmpDir = "/tmp/kubekey"
|
||||
DefaultSSHPort = 22
|
||||
DefaultLBPort = 6443
|
||||
DefaultApiserverPort = 6443
|
||||
DefaultLBDomain = "lb.kubesphere.local"
|
||||
DefaultNetworkPlugin = "calico"
|
||||
DefaultPodsCIDR = "10.233.64.0/18"
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ func (g *GenerateKubeadmConfig) Execute(runtime connector.Runtime) error {
|
|||
"ClusterName": g.KubeConf.Cluster.Kubernetes.ClusterName,
|
||||
"DNSDomain": g.KubeConf.Cluster.Kubernetes.DNSDomain,
|
||||
"AdvertiseAddress": host.GetInternalAddress(),
|
||||
"ControlPlanPort": g.KubeConf.Cluster.ControlPlaneEndpoint.Port,
|
||||
"BindPort": kubekeyv1alpha2.DefaultApiserverPort,
|
||||
"ControlPlaneEndpoint": fmt.Sprintf("%s:%d", g.KubeConf.Cluster.ControlPlaneEndpoint.Domain, g.KubeConf.Cluster.ControlPlaneEndpoint.Port),
|
||||
"PodSubnet": g.KubeConf.Cluster.Network.KubePodsCIDR,
|
||||
"ServiceSubnet": g.KubeConf.Cluster.Network.KubeServiceCIDR,
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ apiVersion: kubeadm.k8s.io/v1beta2
|
|||
kind: InitConfiguration
|
||||
localAPIEndpoint:
|
||||
advertiseAddress: {{ .AdvertiseAddress }}
|
||||
bindPort: {{ .ControlPlanPort }}
|
||||
bindPort: {{ .BindPort }}
|
||||
nodeRegistration:
|
||||
{{- if .CriSock }}
|
||||
criSocket: {{ .CriSock }}
|
||||
|
|
@ -116,7 +116,7 @@ discovery:
|
|||
controlPlane:
|
||||
localAPIEndpoint:
|
||||
advertiseAddress: {{ .AdvertiseAddress }}
|
||||
bindPort: {{ .ControlPlanPort }}
|
||||
bindPort: {{ .BindPort }}
|
||||
certificateKey: {{ .CertificateKey }}
|
||||
{{- end }}
|
||||
nodeRegistration:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package loadbalancer
|
||||
|
||||
import (
|
||||
kubekeyapiv1alpha2 "github.com/kubesphere/kubekey/apis/kubekey/v1alpha2"
|
||||
"github.com/kubesphere/kubekey/pkg/common"
|
||||
"github.com/kubesphere/kubekey/pkg/core/action"
|
||||
"github.com/kubesphere/kubekey/pkg/core/connector"
|
||||
|
|
@ -50,7 +51,7 @@ func (h *HaproxyModule) Init() {
|
|||
Dst: filepath.Join(common.HaproxyDir, templates.HaproxyConfig.Name()),
|
||||
Data: util.Data{
|
||||
"MasterNodes": templates.MasterNodeStr(h.Runtime, h.KubeConf),
|
||||
"LoadbalancerApiserverPort": h.KubeConf.Cluster.ControlPlaneEndpoint.Port,
|
||||
"LoadbalancerApiserverPort": kubekeyapiv1alpha2.DefaultApiserverPort,
|
||||
"LoadbalancerApiserverHealthcheckPort": 8081,
|
||||
"KubernetesType": h.KubeConf.Cluster.Kubernetes.Type,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package templates
|
||||
|
||||
import (
|
||||
kubekeyapiv1alpha2 "github.com/kubesphere/kubekey/apis/kubekey/v1alpha2"
|
||||
"github.com/kubesphere/kubekey/pkg/common"
|
||||
"github.com/kubesphere/kubekey/pkg/core/connector"
|
||||
"github.com/lithammer/dedent"
|
||||
|
|
@ -74,7 +75,7 @@ backend kube_api_backend
|
|||
func MasterNodeStr(runtime connector.ModuleRuntime, conf *common.KubeConf) []string {
|
||||
masterNodes := make([]string, len(runtime.GetHostsByRole(common.Master)))
|
||||
for i, node := range runtime.GetHostsByRole(common.Master) {
|
||||
masterNodes[i] = node.GetName() + " " + node.GetAddress() + ":" + strconv.Itoa(conf.Cluster.ControlPlaneEndpoint.Port)
|
||||
masterNodes[i] = node.GetName() + " " + node.GetAddress() + ":" + strconv.Itoa(kubekeyapiv1alpha2.DefaultApiserverPort)
|
||||
}
|
||||
return masterNodes
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue