名称
ip地址
cpu
内存
k3s-master
10.65.91.53
4c
8G
k3s-node
10.65.91.52
4c
8G
# 改国内yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#安装 docker-ce
yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
# 解决内核检查问题 重启生效
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
systemctl enable docker
systemctl start docker
# 修改 docker 源
cat << EOF > /etc/docker/daemon.json
{
"registry-mirrors": [
"https://1nj0zren.mirror.aliyuncs.com",
"https://docker.mirrors.ustc.edu.cn",
"http://f1361db2.m.daocloud.io",
"https://registry.docker-cn.com"
],
"insecure-registries": ["10.65.91.53:5000"]
}
EOF
systemctl daemon-reload
systemctl restart docker
# 安装 docker 结束
# 关 firewalld 防火墙
systemctl stop firewalld
systemctl disable firewalld
# 安装 k3s
curl -sfL http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -s - --docker
#查看node节点
# kubectl get node
NAME STATUS ROLES AGE VERSION
k3s-master Ready control-plane,master 29h v1.23.6+k3s1
#查看pod
# kubectl get pod -n kube-system
NAME READY STATUS RESTARTS AGE
helm-install-traefik-crd-bfnrf 0/1 Completed 0 29h
helm-install-traefik-jhvzm 0/1 Completed 0 29h
coredns-d76bd69b-hwvfh 1/1 Running 3 (5h47m ago) 29h
local-path-provisioner-6c79684f77-6xhjj 1/1 Running 3 (5h47m ago) 29h
svclb-traefik-n985w 2/2 Running 6 (5h47m ago) 29h
traefik-df4ff85d6-c7jb8 1/1 Running 4 (5h47m ago) 29h
metrics-server-7cd5fcb6b7-k8q2h 1/1 Running 3 (5h47m ago) 29h
svclb-traefik-tzndk 2/2 Running 2 (6h37m ago) 15m
# 查看 token , 用于客户端安装
# cat /var/lib/rancher/k3s/server/node-token
K107d1126b89536fd7390971ed6a2343c88adb6a3fe46acce94da2842619dd0f1e3::server:7380c0e2743694653757a4ee0cc3badc
#拷贝k3s 包
scp -qpr 10.65.91.53:/usr/local/bin/k3s /usr/local/bin/
#安装node节点
wget https://raw.githubusercontent.com/rancher/k3s/master/install.sh -O install.sh
export K3S_URL=https://10.65.91.53:6443
export K3S_TOKEN=K107d1126b89536fd7390971ed6a2343c88adb6a3fe46acce94da2842619dd0f1e3::server:7380c0e2743694653757a4ee0cc3badc
export INSTALL_K3S_SKIP_DOWNLOAD=true && sh install.sh agent --with-node-id --docker
# kubectl get node
NAME STATUS ROLES AGE VERSION
k3s-node Ready <none> 21m v1.23.6+k3s1
k3s-master Ready control-plane,master 29h v1.23.6+k3s1
手机扫一扫
移动阅读更方便
你可能感兴趣的文章