BlueXIII's Blog

热爱技术,持续学习

0%

K3S部署笔记

官网

参考文档

测试机

  • 10.193.34.2
  • 10.193.34.3

Yum源

1
2
3
4
5
cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/ 
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
yum clean all && yum makecache

CentOS7内核升级

https://zhuanlan.zhihu.com/p/368879345

K3S离线包

https://github.com/rancher/k3s/releases

离线安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 下载
wget https://bluexiii-files.oss-cn-beijing.aliyuncs.com/install.sh
wget https://bluexiii-files.oss-cn-beijing.aliyuncs.com/k3s
wget https://bluexiii-files.oss-cn-beijing.aliyuncs.com/k3s-airgap-images-amd64.tar.gz
chmod +x install.sh
chmod +x k3s
mkdir -p /var/lib/rancher/k3s/agent/images/
cp ./k3s-airgap-images-amd64.tar.gz /var/lib/rancher/k3s/agent/images/
cp k3s /usr/local/bin/k3s

# Master
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
cat /var/lib/rancher/k3s/server/node-token

# Agent
INSTALL_K3S_SKIP_DOWNLOAD=true K3S_URL=https://10.193.34.2:6443 K3S_TOKEN=K108a518c04bb5139e71da5822461293fe4016b0ae5a46db42f8b105d1a4a3369e4::server:b1af43bb495176c4050d4c2f4907a75f ./install.sh

Registry

1
2
3
4
5
6
7
8
9
docker pull registry:latest

docker run -itd \
--name registry \
--hostname registry \
--volume /root/registry:/var/lib/registry/docker/registry \
--publish 5000:5000 \
--restart unless-stopped \
registry:latest

http://10.193.34.2:5000

Helm

文档

https://github.com/helm/helm/releases
https://helm.sh/zh/docs/intro/install/

安装

1
2
wget https://bluexiii-files.oss-cn-beijing.aliyuncs.com/helm-v3.9.1-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/helm

Docker离线

https://blog.51cto.com/90xpy/2722642
https://github.com/docker/compose/releases

Docker在线

https://www.cnblogs.com/yyee/p/12905165.html
https://github.com/duiying/ops/tree/master/docker-ce-yum-install

Harbor离线

https://segmentfault.com/a/1190000040905311
https://learnku.com/articles/29884
https://github.com/duiying/OPS/tree/master/harbor-install

http://10.193.34.4:9010
admin/Harbor12345

1
2
3
4
5
6
7
8
vi /etc/docker/daemon.json
{
"insecure-registries" : ["10.193.34.4:9010"]
}

docker login 10.193.34.4:9010
docker tag nginx:latest 10.193.34.4:9010/dubhe/nginx:latest
docker push 10.193.34.4:9010/dubhe/nginx:latest