Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // KubeadmCfgTempl defines the template of kubeadm configuration file. KubeadmCfgTempl = template.Must(template.New("kubeadmCfg").Funcs(funcMap).Parse( dedent.Dedent(`{{- if .IsInitCluster -}} --- apiVersion: kubeadm.k8s.io/v1beta2 kind: ClusterConfiguration etcd: external: endpoints: {{- range .ExternalEtcd.Endpoints }} - {{ . }} {{- end }} caFile: {{ .ExternalEtcd.CaFile }} certFile: {{ .ExternalEtcd.CertFile }} keyFile: {{ .ExternalEtcd.KeyFile }} dns: type: CoreDNS imageRepository: {{ .CorednsRepo }} imageTag: {{ .CorednsTag }} imageRepository: {{ .ImageRepo }} kubernetesVersion: {{ .Version }} certificatesDir: /etc/kubernetes/pki clusterName: {{ .ClusterName }} controlPlaneEndpoint: {{ .ControlPlaneEndpoint }} networking: dnsDomain: {{ .ClusterName }} podSubnet: {{ .PodSubnet }} serviceSubnet: {{ .ServiceSubnet }} apiServer: extraArgs: {{ toYaml .ApiServerArgs | indent 4}} certSANs: {{- range .CertSANs }} - {{ . }} {{- end }} controllerManager: extraArgs: node-cidr-mask-size: "{{ .NodeCidrMaskSize }}" {{ toYaml .ControllerManagerArgs | indent 4 }} extraVolumes: - name: host-time hostPath: /etc/localtime mountPath: /etc/localtime readOnly: true scheduler: extraArgs: {{ toYaml .SchedulerArgs | indent 4 }} --- apiVersion: kubeadm.k8s.io/v1beta2 kind: InitConfiguration localAPIEndpoint: advertiseAddress: {{ .AdvertiseAddress }} bindPort: {{ .ControlPlanPort }} nodeRegistration: {{- if .CriSock }} criSocket: {{ .CriSock }} {{- end }} kubeletExtraArgs: cgroup-driver: {{ .CgroupDriver }} --- apiVersion: kubeproxy.config.k8s.io/v1alpha1 kind: KubeProxyConfiguration {{ toYaml .KubeProxyConfiguration }} --- apiVersion: kubelet.config.k8s.io/v1beta1 kind: KubeletConfiguration {{ toYaml .KubeletConfiguration }} {{- else -}} --- apiVersion: kubeadm.k8s.io/v1beta2 kind: JoinConfiguration discovery: bootstrapToken: apiServerEndpoint: {{ .ControlPlaneEndpoint }} token: "{{ .BootstrapToken }}" unsafeSkipCAVerification: true tlsBootstrapToken: "{{ .BootstrapToken }}" {{- if .IsControlPlane }} controlPlane: localAPIEndpoint: advertiseAddress: {{ .AdvertiseAddress }} bindPort: {{ .ControlPlanPort }} certificateKey: {{ .CertificateKey }} {{- end }} nodeRegistration: {{- if .CriSock }} criSocket: {{ .CriSock }} {{- end }} kubeletExtraArgs: cgroup-driver: {{ .CgroupDriver }} {{- end }} `))) )
Functions ¶
func GenerateKubeadmCfg ¶
func GenerateKubeadmCfg(mgr *manager.Manager, node *kubekeyapiv1alpha1.HostCfg, isInitCluster bool, bootstrapToken, certificateKey string) (string, error)
GenerateKubeadmCfg create kubeadm configuration file to initialize the cluster.
func GetKubeletConfiguration ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.