环境信息:
K3s 版本: v1.21.7+k3s1
节点 CPU 架构、操作系统和版本:: Linux k3s-prod-master1 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed May 18 16:02:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
集群配置: 3server,3agent
问题描述:
复现步骤:
- 安装 K3s 的命令:
预期结果:
实际结果:
附加上下文/日志:
当我的lb-ip和k3s server的ip不处于同一网段(但能相互connect上),agent加入节点报错token CA hash does not match the Cluster CA certificate hash
loadbalance ip: 10.2.4.16
k3s server ip: 10.0.1.11
lb配置
stream {
upstream k3s {
least_conn;
server xxx:6443 max_fails=3 fail_timeout=5s;
}
server {
listen 6443;
proxy_pass k3s;
}
}
k3s
# k3s
export K3S_CLUSTER_INIT=true
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
export INSTALL_K3S_VERSION=v1.21.7+k3s1
export INSTALL_K3S_EXEC="server \
--tls-san rancher.k3s.cn \
--kubelet-arg max-pods=300 \
--kube-apiserver-arg service-node-port-range=30000-40000"
当curl lb-ip:6443/api的时候, 报错401
curl --insecure https://<lb-ip>:6443/api --header "Authorization: bearer $token"
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "Unauthorized",
"reason": "Unauthorized",
"code": 401
}