修改kubeadm默认配置

func getAPIServerCommand(cfg *kubeadmapi.ClusterConfiguration, localAPIEndpoint *kubeadmapi.APIEndpoint) []string {
        defaultArguments := map[string]string{
                "audit-log-path":                  "/var/log/apiserver.log",
                "audit-log-maxage":                "30",
                "audit-log-maxbackup":             "10",
                "audit-log-maxsize":               "100",
                "profiling":                       "false",
                "advertise-address":               localAPIEndpoint.AdvertiseAddress,
                "insecure-port":                   "0",
                "enable-admission-plugins":        "NodeRestriction",
                "service-cluster-ip-range":        cfg.Networking.ServiceSubnet,
                "service-account-key-file":        filepath.Join(cfg.CertificatesDir, kubeadmconstants.ServiceAccountPublicKeyName),
                "client-ca-file":                  filepath.Join(cfg.CertificatesDir, kubeadmconstants.CACertName),
                "tls-cert-file":                   filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerCertName),
                "tls-private-key-file":            filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKeyName),
                "kubelet-client-certificate":      filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKubeletClientCertName),
                "kubelet-client-key":              filepath.Join(cfg.CertificatesDir, kubeadmconstants.APIServerKubeletClientKeyName),
                "enable-bootstrap-token-auth":     "true",
                "secure-port":                     fmt.Sprintf("%d", localAPIEndpoint.BindPort),
                "allow-privileged":                "true",
                "kubelet-preferred-address-types": "InternalIP,ExternalIP,Hostname",
                // add options to configure the front proxy.  Without the generated client cert, this will never be useable
                // so add it unconditionally with recommended values
                "requestheader-username-headers":     "X-Remote-User",
                "requestheader-group-headers":        "X-Remote-Group",
                "requestheader-extra-headers-prefix": "X-Remote-Extra-",
                "requestheader-client-ca-file":       filepath.Join(cfg.CertificatesDir, kubeadmconstants.FrontProxyCACertName),
                "requestheader-allowed-names":        "front-proxy-client",
                "proxy-client-cert-file":             filepath.Join(cfg.CertificatesDir, kubeadmconstants.FrontProxyClientCertName),
                "proxy-client-key-file":              filepath.Join(cfg.CertificatesDir, kubeadmconstants.FrontProxyClientKeyName),
        }

文件路径:

kubernetes/cmd/kubeadm/app/phases/controlplane/manifests.go

默认配置函数:

getAPIServerCommand

getControllerManagerCommand

getSchedulerCommand

Guess you like

Origin blog.csdn.net/lyj22/article/details/121401475