playbook/roles/k3s/files/setup-cni-cilium.sh: add flannel clean opts
This commit is contained in:
parent
45bbb357c9
commit
fe8eb3ae2b
@ -11,7 +11,7 @@
|
||||
cluster_domain: 'cluster.local'
|
||||
version: 'v1.24.7+k3s1'
|
||||
ingress: apisix
|
||||
cni: default
|
||||
cni: kubeovn
|
||||
pod_cidr: '10.100.0.0/16'
|
||||
pod_gateway: '10.100.0.1'
|
||||
svc_cidr: '172.16.0.0/16'
|
||||
|
||||
19
playbook/roles/k3s/files/setup-cni-cilium.sh
Normal file
19
playbook/roles/k3s/files/setup-cni-cilium.sh
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
# 移除cni命名空间
|
||||
ip netns show 2>/dev/null | grep cni- | xargs -r -t -n 1 ip netns delete
|
||||
# 移除cnio网卡
|
||||
ip link show 2>/dev/null | grep 'master cni0' | while read ignore iface ignore; do
|
||||
iface=${iface%%@*}
|
||||
[ -z "$iface" ] || ip link delete $iface
|
||||
done
|
||||
ip link delete cni0
|
||||
ip link delete flannel.1
|
||||
rm -rf /var/lib/cni/
|
||||
# 清理iptables
|
||||
iptables-save | grep -v KUBE- | grep -v CNI- | iptables-restore
|
||||
|
||||
helm repo add cilium https://helm.cilium.io/
|
||||
helm install cilium cilium/cilium --version 1.10.4 \
|
||||
--namespace kube-system\
|
||||
--set hubble.relay.enabled=true \
|
||||
--set hubble.ui.enabled=true
|
||||
@ -9,6 +9,19 @@ modprobe iptable_nat
|
||||
|
||||
rm -rvf /etc/cni/net.d/*
|
||||
|
||||
# 移除cni命名空间
|
||||
ip netns show 2>/dev/null | grep cni- | xargs -r -t -n 1 ip netns delete
|
||||
# 移除cnio网卡
|
||||
ip link show 2>/dev/null | grep 'master cni0' | while read ignore iface ignore; do
|
||||
iface=${iface%%@*}
|
||||
[ -z "$iface" ] || ip link delete $iface
|
||||
done
|
||||
ip link delete cni0
|
||||
ip link delete flannel.1
|
||||
rm -rf /var/lib/cni/
|
||||
# 清理iptables
|
||||
iptables-save | grep -v KUBE- | grep -v CNI- | iptables-restore
|
||||
|
||||
kubectl taint node $node_name node-role.kubernetes.io/control-plane:NoSchedule-
|
||||
kubectl label node $node_name kubernetes.io/os=linux --overwrite
|
||||
kubectl label node $node_name kube-ovn/role=master --overwrite
|
||||
|
||||
Loading…
Reference in New Issue
Block a user