我是靠谱客的博主 想人陪小甜瓜,最近开发中收集的这篇文章主要介绍k8s安装,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

master:

yum upgrade
yum update
ifconfig ens33
cat /sys/class/dmi/id/product_uuid
swapoff -a
vim /etc/fstab
#/dev/mapper/cl-swap swap swap defaults 0 0

vim /etc/sysctl.conf
vm.swappiness = 0
net.bridge.bridge-nf-call-arptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

lsmod |grep br_netfilter
modprobe br_netfilter
lsmod |grep br_netfilter
sysctl -p

systemctl disable firewalld.service && systemctl stop firewalld.service

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sudo sed -i ‘s+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+’ /etc/yum.repos.d/docker-ce.repo
yum makecache
yum install docker-ce-19.03.15
systemctl enable docker
systemctl start docker

cat < /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

setenforce 0

cat /etc/selinux/config

disabled - No SELinux policy is loaded.

SELINUX=disabled

yum install kubeadm kubelet kubectl

systemctl enable kubelet.service

kubeadm init --kubernetes-version=v1.21.1 --apiserver-advertise-address 192.168.72.100 --pod-network-cidr 10.244.0.0/16

wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
docker pull quay.io/coreos/flannel:v0.14.0

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown ( i d − u ) : (id -u): (idu):(id -g) $HOME/.kube/config

kubectl get nodes
kubectl apply -f kube-flannel.yml
kubectl get nodes

[root@k8smaster ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8smaster Ready control-plane,master 44m v1.21.1
k8snode1 Ready 12m v1.21.1
k8snode2 Ready 11m v1.21.1

node:

kubeadm join 192.168.168.5:6443 --token vmkj30.n8udsom3uia13cfp

    --discovery-token-ca-cert-hash sha256:b8a50fb27169d6b2ff3ff24bc9c519a195c3f167bd603381f660a80b3a7f4e40 

最后

以上就是想人陪小甜瓜为你收集整理的k8s安装的全部内容,希望文章能够帮你解决k8s安装所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部