feat(doc): 文档优化

这个提交包含在:
2024-04-23 11:30:16 +08:00
未验证
父节点 7ebe4cdb4c
当前提交 ee4198ce40
修改 3 个文件,包含 29 行新增27 行删除
+4 -4
查看文件
@@ -1,12 +1,12 @@
### 调试
`
```shell
kubectl run -i --tty --rm --restart=Never \
--overrides='{"apiVersion": "v1", "spec": {"nodeSelector": {"kubernetes.io/hostname": "tcc"}}}' \
--image=busybox:1.28 \
debug -- sh
`
```
### path core中服务的节点亲和性 使他们只运行在master节点上
`
```shell
kubectl patch -n kube-system deployment coredns --patch-file=patch-affinity.yaml
`
```
+24 -23
查看文件
@@ -1,64 +1,65 @@
### 替换hostname
`
```shell
export HOSTNAME=node
hostnamectl set-hostname $HOSTNAME && reboot
vim /etc/hosts
`
```
### 安装tailscale
`
```shell
curl -fsSL https://tailscale.com/install.sh | sh
`
```
### 开启tailscale的自动更新
`
```shell
tailscale set --auto-update
`
```
### 开启ip转发
`
```shell
echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
sysctl -p /etc/sysctl.d/99-tailscale.conf
`
```
### 新建目录 将不同节点类型的config写入
`
```shell
mkdir -p /etc/rancher/k3s && vim /etc/rancher/k3s/config.yaml
`
```
### 安装k3s 此处注意安装类型 是server 还是 agent
`
```shell
curl -sfL https://get.k3s.io | \
INSTALL_K3S_VERSION=v1.28.8 \
INSTALL_K3S_VERSION=v1.28.8+k3s1 \
INSTALL_K3S_MIRROR=cn \
sh -s - server
`
```
### 国内安装加速 & 镜像加速地址
https://rancher-mirror.rancher.cn/k3s/k3s-install.sh
`
```shell
vim /etc/rancher/k3s/registries.yaml
`
```
### 查看serverToken 记得在config中替换最新的token
`
```shell
cat /var/lib/rancher/k3s/server/node-token
`
```
### 查看api server config 需要替换到.kube/config中 注意将其中的server地址替换为高可用地址
`
```shell
cat /etc/rancher/k3s/k3s.yaml
`
```
### 给node添加地域标签
`
```shell
kubectl label nodes tca topology.kubernetes.io/region=cn-sh
kubectl label nodes tca svccontroller.k3s.cattle.io/enablelb="true"
`
```
### 给master节点添加污点
`
```shell
kubectl taint nodes tca node-role.kubernetes.io/master:NoSchedule
`
```
+1
查看文件
@@ -3,6 +3,7 @@ server: "https://k3s.dev.cm:6443"
token: "K1012101b9ab5a404897d6a0530f9dac014b571b374251e3741c95fd74e86cee2e5::server:97760133590f01e7a94ab320dfdbfe96"
# 网络相关
# 阿里云vps 需要添加 extraArgs=--netfilter-mode=off
vpn-auth: "name=tailscale,joinKey=tskey-auth-ksJXXH4CNTRL-4WRkX448yC6W6yhytK1FD68HMDK4zStw"
# 节点相关