在我的v1.11.1集群中,我通过创建新令牌(kubeadm token create --print-join-command
)添加了新节点。节点已成功加入集群并处于“就绪”状态。在日志文件中,我看到以下消息。
为什么抛出此消息?如何解决此问题?
Jul 24 08:45:45 node03 kubelet: E0724 08:45:45.326489 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
Jul 24 08:46:00 node03 kubelet: E0724 08:46:00.327264 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
Jul 24 08:46:03 node03 kubelet: E0724 08:46:03.353306 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
Jul 24 08:46:15 node03 kubelet: E0724 08:46:15.324814 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
Jul 24 08:46:30 node03 kubelet: E0724 08:46:30.324926 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
Jul 24 08:46:33 node03 kubelet: E0724 08:46:33.353238 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
Jul 24 08:46:45 node03 kubelet: E0724 08:46:45.324950 2580 server.go:222] Unable to authenticate the request due to an error: invalid bearer token
谢谢 锶
更新
bootstrap-kubelet.conf
apiVersion: v1
clusters:
- cluster:
server: https://kubeapi:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: tls-bootstrap-token-user
name: tls-bootstrap-token-user@kubernetes
current-context: tls-bootstrap-token-user@kubernetes
kind: Config
preferences: {}
users:
- name: tls-bootstrap-token-user
user:
token: l8um3f.ll9xxgxbhmiv6ivn
kubelet.conf
apiVersion: v1
clusters:
- cluster:
server: https://kubeapi:6443
name: default-cluster
contexts:
- context:
cluster: default-cluster
namespace: default
user: default-auth
name: default-context
current-context: default-context
kind: Config
preferences: {}
users:
- name: default-auth
user:
client-key: /var/lib/kubelet/pki/kubelet-client-current.pem
这样运行的进程
/usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-driver=cgroupfs --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --network-plugin=cni