当前位置:网站首页>Kubernetes - bare metal cluster environment
Kubernetes - bare metal cluster environment
2022-06-22 05:16:00 【Wu Shengzi night song】
The master node needs
- docker( It can be another container runtime )
- kubectl( Cluster command line interaction tool )
- kubeadm( Cluster initialization tool )
Work node needs
- docker( It can also be another container runtime )
- kubelet( management Pod And the container , Ensure their healthy and stable operation )
- kube-proxy( Network proxy , Responsible for network related work )
Get ready 3 Servers
Master (10.0.20.9)
Node1 (10.0.8.8)
Node2 (10.0.12.12)
Set the corresponding host name for each node
hostnamectl set-hostname master
hostnamectl set-hostname node1
hostnamectl set-hostname node2



All nodes are modified hosts
vim /etc/hosts
10.0.20.9 master
10.0.8.8 node1
10.0.12.12 node2
All nodes shut down SELinux
setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
All nodes ensure that the firewall is turned off
systemctl stop firewalld
systemctl disable firewalld
close swap
sudo swapoff -a ( If the machine restarts , This sentence needs to be executed again )
It can also be permanently disabled
sudo vim /etc/fstab
take swap Comment out that line
Add installation source
add to k8s Install source
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
add to Docker Install source
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Install the required components ( All nodes )
# Don't pretend 1.24, Failed to initialize cluster
yum install -y docker-ce
yum install -y kubelet-1.23.0
yum install -y kubeadm-1.23.0
yum install -y kubectl-1.23.0
start-up kubelet、docker, And set boot up ( All nodes )
systemctl enable kubelet
systemctl start kubelet
systemctl enable docker
systemctl start docker
modify docker To configure ( All nodes )
# kubernetes The official recommendation docker Etc systemd As cgroupdriver, otherwise kubelet It won't start
cat <<EOF > daemon.json { "exec-opts": ["native.cgroupdriver=systemd"], "registry-mirrors": ["https://ud6340vz.mirror.aliyuncs.com"] } EOF
mv daemon.json /etc/docker/
# Restart and take effect
systemctl daemon-reload
systemctl restart docker
use kuberadm Initialize cluster ( Primary node only )
# Initialize the cluster console Control plan
# If you fail, you can use kubeadm reset Reset
kubeadm init --kubernetes-version=v1.23.0 --image-repository=registry.aliyuncs.com/google_containers --v=6
# Remember to kubeadm join xxx Save up
# If you forget it, you need to get it again :kubeadm token create --print-join-command
# Copy authorization file , In order to kubectl You can have access to the cluster
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
# Create... On other machines ~/.kube/config Documents can also pass kubectl Access to cluster


Add the work node to the cluster ( Run only on the work node )
# Returned when initializing the cluster
kubeadm join 10.0.20.9:6443 --token 0dlyrh.wpzp6dvpx5fdxfzt --discovery-token-ca-cert-hash sha256:5b6f9a7d6ac30904c6b2018567930ff7ca3d652f804bbb100a72360003305d75

Look at the node :kubectl get node
Install network plug-ins , otherwise node yes NotReady state ( Master node operation )
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

The node has Ready:
边栏推荐
- C语言字符串的一些使用注意事项
- Compilation des connaissances communes de la base de données numpy
- Some notes on the use of C language strings
- SQL分类,用户属性
- Free questions for polymerization process and test papers for polymerization process in 2022
- Lottie components make animation easier
- Squoosh - Google's free open source image compression tool, reducing the image size by 90%! Support API development calls
- It's 2022. Don't you hurry to learn typescript?
- Contents of 2022 tea master (intermediate) examination and tea master (intermediate) examination
- Graph calculation on nlive:nepal's graph calculation practice
猜你喜欢

Geographic location type of redis

Sort ten integers using selection

Lottie components make animation easier

Analysis of T elevator repair in 2022 and simulation test questions of T elevator repair

9 practical shell scripts, recommended collection!

Privatized lightweight continuous integration deployment scheme --05- continuous deployment service -drone (Part 1)

Accelerate the promotion of industrial Internet, and map out a new blueprint for development

When idea creates a method, it uses annotations to prompt method parameters (param), return value (return), and method function (description)

Idea创建方法时,使用注解提示方法参数(param)、返回值(return)、方法作用(Description)

毕业回馈!Apache Doris 社区所有贡献者来领礼品啦!
随机推荐
C语言字符串的一些使用注意事项
Kubernetes——使用minikube搭建环境
Database - basic knowledge
Restframework read and non read sequence processing
数据库---基础知识
In 2022, the postgraduate entrance examination ran aground | how to counter attack famous IT enterprises and become a programmer in three months
Graduation feedback! All contributors of Apache Doris community come to receive gifts!
Progress warning and problem management of progress control in Zhiyuan project management SPM system
Reading notes on how MySQL works [updating]
Progress information collection for progress control of Zhiyuan project management SPM system
In 2022, the third batch (principal) of Guangdong Provincial Safety Officer a certificate was found and analyzed, and the third batch (principal) of Guangdong Provincial Safety Officer a certificate w
Flink deployment mode (I) - standalone and Application
力扣33【搜索旋转排序数组】
数据的备份与恢复
DTS迁移秘籍-SQLSERVER篇
flink部署模式(二)- yarn三种部署模式
使用keytool从.jks文件获取SSL certificate
Gavin's perception of transformer live class - NLU and policies data decryption, source code analysis and practice of insurance BOT in the insurance industry of Rasa dialogue robot project (57)
1108. Defanging an IP Address
在Vs Code中搭建JSP开发环境