Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use kubeadm in K8s

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use kubeadm in K8s. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Download Super kubeadm download kubernetes1.14.0+ offline package using tutorial environment introduction iprole10.103.97.200master010.103.97.201master010.103.97.202master010.103.97.2virtulIPapiserver.cluster.localapiserver parsing name

Initialize on each node

Tar zxvf kube1.14.0.tar.gz & & cd kube/shell & & sh init.sh

Replace the kubeadm in the replacement package with the downloaded kubeadm:

Cp kubeadm / usr/bin/kubeadmkubeadm configuration file

Cat kubeadm-config.yaml:

ApiVersion: kubeadm.k8s.io/v1beta1kind: ClusterConfigurationkubernetesVersion: v1.14.0controlPlaneEndpoint: "apiserver.cluster.local:6443" # use the resolution name to access APIserverapiServer: certSANs:-127.0.0.1-apiserver.cluster.local-172.20.241.205-172.20.241.206-172.20.241.207-172.20.241.208 -10.103.97.2 # Virtual IP is added to the certificate-apiVersion: kubeproxy.config.k8s.io/v1alpha1kind: KubeProxyConfigurationmode: "ipvs" ipvs: excludeCIDRs:-"10.103.97.2 IPVS 32" # if this k8s is not added, the user-created IPVS rules will be cleaned regularly Causes the agent to fail to install calico on master0 10.103.97.200 apiserver.cluster.local "10.103.97.200 apiserver.cluster.local" > / etc/hostskubeadm init-- config=kubeadm-config.yaml-- experimental-upload-certs mkdir ~ / .kube & & cp / etc/kubernetes/admin.conf ~ / .kube/configkubectl apply-f calico #

After execution, some logs are output, which contain the commands needed by join.

# Note on master1 10.103.97.201 Parse to master0 before installation, and change it to yourself after successful installation, because kubelet kube-proxy is configured with this parsing name. If you do not change the parsing, the whole cluster will not be able to use echo "10.103.97.200 apiserver.cluster.local" > > / etc/hosts kubeadm join 10.103.97.200 echo 6443-- token 9vr73a.a8uxyaju799qwdjv\-- discovery-token-ca-cert-hash sha256:7c2e69131a36ae2a042a339b33381c6d0d43887e2de83720eff5359e26aec866\-- experimental-control-plane\-- certificate-key f8902e114ef118304e561c3ecd4d0b543adc226b7a07f675f56564185ffe0c07.

Sed "master2 10.103.97.200Universe 10.103.97.201ppg"-I / etc/hosts # parse to change its own local address on master2 10.103.97.202, same as master1

Echo "10.103.97.200 apiserver.cluster.local" > > / etc/hostskubeadm join 10.103.97.200 etc/hostskubeadm join 6443-token 9vr73a.a8uxyaju799qwdjv\-- discovery-token-ca-cert-hash sha256:7c2e69131a36ae2a042a339b33381c6d0d43887e2de83720eff5359e26aec866\-- experimental-control-plane\-- certificate-key f8902e114ef118304e561c3ecd4d0b543adc226b7a07f675f56564185ffe0c07

Sed "sswap 10.103.97.200Universe 10.103.97.201mp g"-I / etc/hosts on the Node node

Through the virtual IP join to the master, this command creates an ipvs rule on the node node, virturl server is the virtual IP and realserver is the three master. Then start a daemon to protect these rules with a static pod. Once which apiserver is inaccessible, clear the realserver, and add it back after the apiserver is connected.

Echo "10.103.97.2 apiserver.cluster.local" > > / etc/hosts # using vipkubeadm join 10.103.97.2 using vipkubeadm join 6443-- token 9vr73a.a8uxyaju799qwdjv\-- master 10.103.97.200 echo 6443\-- master 10.103.97.201purl 6443\-- master 10.103.97.202 Vol 6443\-- discovery-token-ca-cert-hash sha256:7c2e69131a36ae2a042a339b33381c6d0d43887e2de83720eff5359e26aec866Architecture +-+ +-+ virturl server: 10.103.97.2 6443 | mater0 |

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report