In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Install and configure master, the master node running Kubernetes, which includes the database of etcd, that is, etcd is not separate from the master node and is used for odd-numbered master node installations.
1. Generate the warehouse configuration file # cat kubeadm-init-config.yaml for kubernets
Modify the configuration file (check the following section)
... apiVersion: kubeadm.k8s.io/v1beta2certificatesDir: / etc/kubernetes/pkiclusterName: kubernetes...dns: type: CoreDNSetcd: local: dataDir: / var/lib/etcd...kind: ClusterConfigurationkubernetesVersion: v1.16.2networking: dnsDomain: cluster.test serviceSubnet: 10.96.0.0/16 podSubnet: 10.244.0.0/16...
Initialize using the command
Kubeadm init- f kubeadm-init-config.yaml
The configuration file for the offline environment initializes the root online environment, but the image file needs to be imported first.
4) initialize subsequent operations
Next, according to the above initialization results, you need to prepare the kubectl environment and install the network for the users of the current master node.
Create the folder $mkdir-p ~ / .kube$ cp / etc/kubernetes/admin.conf ~ / .kube / config install the network plug-in syntax: "kubectl apply-f [podnetwork] .yaml"
The flannel we use here (developed by coreos). There are specific installation instructions on the github page, address https://github.com/coreos/flannel.
# kubectl apply-f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
If it is an offline installation, you can download the packaged flannel image and kube-flannel.yml file first, and then install it using kubectl. The details are as follows:
Download flannel
Docker pull query.io/coreos/flannel
Package flannel and save it locally
Docker save query.io/coreos/flannel-o / flannel-0.11.0.tar
Mount flannel Mirror
Docker load-I / flannel-0.11.0.tar
Download the kube-flannel.yml file
Wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Install flannel
Kubectl apply-f kube-flannel.yml
You can then use the command "kubectl get pods-n kube-system" to view it.
Reference:
Kubeadm-config.yaml configuration syntax reference: https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2kubeadm-config.yaml configuration master node: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/control-plane-flags/kube-proxy enable ipvs: https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/ipvs/README.mdkubelet configuration example reference: https://kubernetes.io / docs/setup/production-environment/tools/kubeadm/kubelet-integration/#configure-kubelets-using-kubeadm5) additional note: kubeadm-config.yaml composition deployment description: InitConfiguration: used to define some initialization configurations ClusterConfiguration, such as token used for initialization and apiserver address: used to define configuration items related to master components such as apiserver, etcd, network, scheduler, controller-manager, etc. KubeletConfiguration: used to define configuration items related to kubelet components KubeProxyConfiguration: used to define configuration items related to kube-proxy components
As you can see, there are only InitConfiguration and ClusterConfiguration parts in the default kubeadm-config.yaml file. We can generate sample files for the other two parts by doing the following:
# generate KubeletConfiguration sample file kubeadm config print init-defaults-- component-configs KubeletConfiguration# generate KubeProxyConfiguration sample file kubeadm config print init-defaults-- docker version approved by kubernete during component-configs KubeProxyConfigurationkubeadm initialization [WARNING SystemVerification]: this docker version is not on the list of validated version: 19.01.1. Latest validated version: 18.06
The above version varies according to the report version of your environment. You can refer to the changelog file of kubernetes in the git repository to determine which docker version is supported, and then follow the command
# yum list docker-ce.x86_64-- showduplicates | sort-r
Get a list of versions and select a specific version to install
Sudo yum-y install docker-ce- [VERSION] kubeadm initialization kubelet is not set for self-startup [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
Solution: execute the self-startup command 'systemctl enable kubelet.service'
Kubeadm initialization does not disable swap: [error Swap]: running with swap on is not enabled, please disable swap [preflight] If you know what you are doing, you can make a check non-fatal with'--ignore-preflight-errors=...'
Solution: you can add the parameter'--ignore-preflight-errors=Swap' to the end of the kubeadm command.
View the configuration of initialized kubeadm kubeadm config viewmaster node participation workload
For clusters initialized with kubeadm, Pod is not scheduled to Master Node for security reasons, which means that Master Node does not participate in the workload. This is because the current master node (such as the name master0) is tainted with node-role.kubernetes.io/master:NoSchedule:
$sudo kubectl describe node master0 | grep TaintTaints: node-role.kubernetes.io/master:NoSchedule
Because the test environment is built here, or for some other reason, you need to remove this stain and allow master0 to participate in the workload:
$sudo kubectl taint nodes master0 node-role.kubernetes.io/master-node "master0" untainted
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.