0
点赞
收藏
分享

微信扫一扫

k3s部署

Greatiga 2022-08-11 阅读 103


 欢迎关注我的公众号:

k3s部署_linux

 目前刚开始写一个月,一共写了18篇原创文章,文章目录如下:

​​istio多集群探秘,部署了50次多集群后我得出的结论​​

​​istio多集群链路追踪,附实操视频​​

​​istio防故障利器,你知道几个,istio新手不要读,太难!​​

​​istio业务权限控制,原来可以这么玩​​

​​istio实现非侵入压缩,微服务之间如何实现压缩​​

​​不懂envoyfilter也敢说精通istio系列-http-rbac-不要只会用AuthorizationPolicy配置权限​​

​​不懂envoyfilter也敢说精通istio系列-02-http-corsFilter-不要只会vs​​

​​不懂envoyfilter也敢说精通istio系列-03-http-csrf filter-再也不用再代码里写csrf逻辑了​​

​​不懂envoyfilter也敢说精通istio系列http-jwt_authn-不要只会RequestAuthorization​​

​​不懂envoyfilter也敢说精通istio系列-05-fault-filter-故障注入不止是vs​​

​​不懂envoyfilter也敢说精通istio系列-06-http-match-配置路由不只是vs​​

​​不懂envoyfilter也敢说精通istio系列-07-负载均衡配置不止是dr​​

​​不懂envoyfilter也敢说精通istio系列-08-连接池和断路器​​

​​不懂envoyfilter也敢说精通istio系列-09-http-route filter​​

​​不懂envoyfilter也敢说精通istio系列-network filter-redis proxy​​

​​不懂envoyfilter也敢说精通istio系列-network filter-HttpConnectionManager​​

​​不懂envoyfilter也敢说精通istio系列-ratelimit-istio ratelimit完全手册​​

 

1准备机器

hostnamectl set-hostname master

hostnamectl set-hostname node01

hostnamectl set-hostname node02

禁用防火墙

systemctl stop firewalld && systemctl disable firewalld

关闭selinux

setenforce 0

vi /etc/selinux/config

关闭swap

swapoff -a

vi /etc/fstab

2安装docker

wget ​​http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo​​

mv docker-ce.repo /etc/yum.repo.d/

yum install docker-ce

设置镜像加速

创建 /etc/docker/daemon.json 文件,并添加如下内容:

{

"registry-mirrors": ["​​https://jzbtfwo9.mirror.aliyuncs.com​​"]

}

启动docker服务

systemctl start docker && systemctl enable docker

3下载k3s

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

chmod +x k3s && mv k3s /usr/local/bin/k3s

4下载安装脚本

​​https://get.k3s.io​​

chmod +x install.sh

5运行安装脚本

./install.sh

6修改service文件

vim /etc/systemd/system/multi-user.target.wants/k3s.service

/usr/local/bin/k3s server --docker --no-deploy traefik

systemctl daemon-reload

systemctl restart k3s

7下载基础镜像

docker pull registry.cn-beijing.aliyuncs.com/ilemonrain/pause-amd64:3.1

docker tag registry.cn-beijing.aliyuncs.com/ilemonrain/pause-amd64:3.1 k8s.gcr.io/pause:3.1

8验证master节点安装

sudo k3s kubectl get node

9部署node节点

下载k3s

K3S_TOKEN在服务器的/var/lib/rancher/k3s/server/node-token

K3S_URL=https://192.168.198.155:6443 K3S_TOKEN=K104137672b9a646c3a6b28492c1aa931961465819d3ecb74b2049ebea2953083e6::server:85a5e20adb353a193ad9954639eb8b5e ./install.sh

下载基础镜像:

docker pull registry.cn-beijing.aliyuncs.com/ilemonrain/pause-amd64:3.1

docker tag registry.cn-beijing.aliyuncs.com/ilemonrain/pause-amd64:3.1 k8s.gcr.io/pause:3.1

修改service文件

vi /etc/systemd/system/k3s-agent.service

ExecStart=/usr/local/bin/k3s \ agent --docker

systemctl daemon-reload

systemctl restart k3s-agent

10验证集群

k3s kubectl get node

k3s kubectl get pod --all-namespaces -o wide

11创建应用

k3s kubectl run nginx --image=nginx

举报

相关推荐

0 条评论