k3s安装
2022-07-22k8skinghu638°c
A+ A-安装依赖
apt install -y ipvsadm ipset echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf echo 'net.bridge.bridge-nf-call-iptables = 1' >> /etc/sysctl.conf echo 'net.bridge.bridge-nf-call-ip6tables = 1' >> /etc/sysctl.conf modprobe ip_vs modprobe br_netfilter sysctl -p
SERVER
# server 禁用traefik 指定外网ip 指定ipvsmos 指定etcd curl -sfL https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn \ INSTALL_K3S_VERSION="v1.21.6+k3s1" \ sh -s - server \ --disable traefik \ --node-external-ip $(curl -s ifconfig.me) \ --kube-proxy-arg=proxy-mode=ipvs \ --datastore-endpoint etcd cat /var/lib/rancher/k3s/server/node-token
AGENT
# agent curl -sfL https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | \ INSTALL_K3S_MIRROR=cn \ INSTALL_K3S_VERSION="v1.21.6+k3s1" \ K3S_URL="https://192.168.37.101:6443" \ K3S_TOKEN=K103730711f30e0cf31c281b395893524fea2cc759ccf35f5df72ad88701857ffbb::server:c7b8acaaa885115977d1d7401f6919bc \ sh -s agent --node-external-ip $(curl -s ifconfig.me)
获取ip
--node-external-ip $(curl -s ifconfig.me) # 内网ip 根据实际情况过滤 --node-ip $(ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"| head -n 1)