Skip to content

Commit

Permalink
feat(k8s): update install
Browse files Browse the repository at this point in the history
  • Loading branch information
miaoyc666 committed May 20, 2024
1 parent 9016da3 commit ec92f9a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
17 changes: 12 additions & 5 deletions K8s/Install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@


### 1.安装CRI
| 运行时 | Unix 域套接字 |
| --- | --- |
| containerd | unix:///var/run/containerd/containerd.sock |
| CRI-O | unix:///var/run/crio/crio.sock |
| 运行时 | Unix 域套接字 |
|-------------------------------| --- |
| containerd | unix:///var/run/containerd/containerd.sock |
| CRI-O | unix:///var/run/crio/crio.sock |
| Docker Engine(使用 cri-dockerd) | unix:///var/run/cri-dockerd.sock |


Expand Down Expand Up @@ -95,9 +95,16 @@ EOF
sysctl --system
```

#### 2.5 添加命令补全
```bash
crictl completion > /etc/bash_completion.d/crictl
kubectl completion bash > /etc/bash_completion.d/kubectl
kubeadm completion bash > /etc/bash_completion.d/kubeadm
```

### 3.初始化Kubeadm
#### 3.1 默认使用containerd初始化
如果使用kube-vip,则修改以下配置:--apiserver-advertise-address=<vip>, apiserver-advertise-address参数的地址指向预先分配好的ip地址。
##### 如果想要配置集群高可用,参考:[使用kube-vip给k8s集群配置vip](kube-vip/README.md)
```bash
# 默认使用containerd初始化
kubeadm init --kubernetes-version=v1.25.2 --apiserver-advertise-address=192.168.88.110 --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16 --cri-socket /var/run/containerd/containerd.sock
Expand Down
5 changes: 5 additions & 0 deletions K8s/cri/Install-containerd.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ EOF
modprobe overlay
modprobe br_netfilter
```
关闭Swap
```bash
sudo swapoff -a
sudo sed -i '/swap/s/^/#/' /etc/fstab
```

### 2.安装containerd
2.1或2.1章节仅执行一次即可
Expand Down
23 changes: 23 additions & 0 deletions K8s/kube-vip/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Kube-vip
=

### 配置集群高可用
#### 1.创建Kube-vip的静态pod
kube-vip的pod需要先于k8s集群创建,因此我们采用static pod方式来创建kube-vip的pod。
在三台master服务器上执行以下命令(VIP和网卡名根据实际情况修改)
```bash
export VIP=192.168.88.200
export INTERFACE=enp0s18

KVVERSION=$(curl -sL https://api.github.com/repos/kube-vip/kube-vip/releases | jq -r ".[0].name")

alias kube-vip="ctr run --rm --net-host ghcr.io/kube-vip/kube-vip:$KVVERSION vip /kube-vip"

kube-vip manifest pod \
--interface $INTERFACE \
--address $VIP \
--controlplane \
--services \
--arp \
--leaderElection | tee /etc/kubernetes/manifests/kube-vip.yaml
```

0 comments on commit ec92f9a

Please sign in to comment.