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 build K8s with kubeadm

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to build K8s in kubeadm". In daily operation, I believe many people have doubts about how to build K8s in kubeadm. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to build K8s in kubeadm". Next, please follow the editor to study!

Kubeadm builds K8s1. Environmental preparation

Operating system: Centos7 (CentOS Linux release 7.9.2009)

Master master node: 1 virtual machine

Node compute node: 2 virtual machines

K8s version:v1.23.5 (newer version selected)

Docker version:20.10.14

I will not expand the creation of the virtual machine in detail.

two。 Virtual machine network configuration (ensure access to the public network)

The choice of virtual machine network card is 1. Network address translation NAT (mainly used to access the external network) 2. Host-only network (mainly used for host access to virtual machines)

Set the corresponding ip as follows

Kube-master 192.168.56.20

Kube-node-1 192.168.56.21

Kube-node-2 192.168.56.22

2.1 3 virtual machines static ip configuration cat / etc/sysconfig/network-scripts/ifcfg-enp0s3TYPE= "Ethernet" PROXY_METHOD= "none" BROWSER_ONLY= "no" BOOTPROTO= "none" # close DEFROUTE= "yes" IPV4_FAILURE_FATAL= "no" IPV6INIT= "yes" IPV6_AUTOCONF= "yes" IPV6_DEFROUTE= "yes" IPV6_FAILURE_FATAL= "no" IPV6_ADDR_GEN_MODE= "stable-privacy" NAME= "enp0s3" UUID= "35eac2d4-234d-4859-848e-ed2a30a64a81" DEVICE= "enp0s3" # add Add part IPADDR= "10.0.2.20" PREFIX= "24" GATEWAY= "10.0.2.2" DNS1= "10.0.2.3" DNS2= "114.114.114.114" ONBOOT= "yes" cat / etc/sysconfig/network-scripts/ifcfg-enp0s8TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=static # to static static ipDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=enp0s8UUID=d06bac6d-294f-4bfe-bf08-5cb65c0a431fDEVICE=enp0s8# add part IPADDR=192.168.56.20PREFIX=24ONBOOT=yes2.2 virtual machine hosts configuration

The configuration in 3 virtual machines / etc/hosts is as follows

192.168.56.20 kube-master192.168.56.21 kube-node-1192.168.56.22 kube-node-2

3.k8s basic environment settings 3.1 yum exchange (optional) yum-y install wgetcd / etc/yum.repos.dmv CentOS-Base.repo CentOS-Base.repo.bakwget-O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repowget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repoyum clean allyum makecache # regenerate cache 3.2 turn off selinuxsetenforce temporary off Close sed-I "s/SELINUX=enforcing/SELINUX=disabled/g" / etc/selinux/config # permanently close 3. 3 close swap partition or disable swap file swapoff-a # comment out the line yes about swap partition | cp / etc/fstab / etc/fstab_bakcat / etc/fstab_bak | grep-v swap > / etc/fstab3.4 allows iptables to check bridge traffic cat

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

Development

Wechat

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

12
Report