Failed to connect to apiserver: the server has asked for the clieto provide credentials

本文涉及的产品
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
简介: Failed to connect to apiserver: the server has asked for the clieto provide credentials

异常信息:

[root@n1 kubernetes]# systemctl status kubelet -l
● kubelet.service - Kubernetes Kubelet
   Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
   Active: active (running) since 二 2022-08-02 19:31:38 CST; 42s ago
     Docs: https://github.com/GoogleCloudPlatform/kubernetes
 Main PID: 80509 (kubelet)
    Tasks: 9
   Memory: 13.0M
   CGroup: /system.slice/kubelet.service
           └─80509 /usr/local/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/kubelet-bootstrap.kubeconfig --cert-dir=/etc/kubernetes/pki --kubecig=/etc/kubernetes/kubelet.kubeconfig --config=/etc/kubernetes/kubelet.config.json --network-plugin=cni --pod-infra-container-image=k8s.gcr.io/paused64:3.1 --allow-privileged=true --alsologtostderr=true --logtostderr=false --log-dir=/var/log/kubernetes --v=2
 
8月 02 19:32:01 n1 kubelet[80509]: I0802 19:32:01.240801   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:03 n1 kubelet[80509]: I0802 19:32:03.277292   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:05 n1 kubelet[80509]: I0802 19:32:05.531491   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:07 n1 kubelet[80509]: I0802 19:32:07.698197   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:09 n1 kubelet[80509]: I0802 19:32:09.946787   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:11 n1 kubelet[80509]: I0802 19:32:11.955601   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:14 n1 kubelet[80509]: I0802 19:32:14.092859   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:16 n1 kubelet[80509]: I0802 19:32:16.101928   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:18 n1 kubelet[80509]: I0802 19:32:18.293540   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:32:20 n1 kubelet[80509]: I0802 19:32:20.408899   80509 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
[root@n1 kubernetes]# journalctl -xef -u kubelet
-- Logs begin at 二 2022-08-02 17:43:29 CST. --
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.598616   80432 flags.go:33] FLAG: --version="false"
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.598635   80432 flags.go:33] FLAG: --vmodule=""
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.598645   80432 flags.go:33] FLAG: --volume-plugin-dir="/usr/libexec/kubernetes/kubelet-plugins/vol/exec/"
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.598656   80432 flags.go:33] FLAG: --volume-stats-agg-period="1m0s"
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.598737   80432 feature_gate.go:226] feature gates: &{map[]}
8月 02 19:28:22 n1 kubelet[80432]: Flag --allow-privileged has been deprecated, will be removed in a future version
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.602278   80432 feature_gate.go:226] feature gates: &{map[RotateKubeletClientCertificate:true RotatbeletServerCertificate:true]}
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.602390   80432 feature_gate.go:226] feature gates: &{map[RotateKubeletClientCertificate:true RotatbeletServerCertificate:true]}
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639153   80432 mount_linux.go:171] Detected OS with systemd
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639224   80432 server.go:417] Version: v1.14.0
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639304   80432 feature_gate.go:226] feature gates: &{map[RotateKubeletClientCertificate:true RotatbeletServerCertificate:true]}
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639400   80432 feature_gate.go:226] feature gates: &{map[RotateKubeletClientCertificate:true RotatbeletServerCertificate:true]}
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639516   80432 plugins.go:103] No cloud provider specified.
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639547   80432 server.go:533] No cloud provider specified: "" from the config file: ""
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.639593   80432 bootstrap.go:118] Using bootstrap kubeconfig to generate TLS client cert, key and kconfig file
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.645893   80432 bootstrap.go:149] No valid private key and/or certificate found, reusing existing pate key or creating a new one
8月 02 19:28:22 n1 kubelet[80432]: I0802 19:28:22.685746   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:28:24 n1 kubelet[80432]: I0802 19:28:24.912832   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:28:27 n1 kubelet[80432]: I0802 19:28:27.025950   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:28:29 n1 kubelet[80432]: I0802 19:28:29.403173   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:28:31 n1 kubelet[80432]: I0802 19:28:31.677202   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:28:33 n1 kubelet[80432]: I0802 19:28:33.738455   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials
8月 02 19:28:35 n1 kubelet[80432]: I0802 19:28:35.927611   80432 bootstrap.go:294] Failed to connect to apiserver: the server has asked for the clieto provide credentials

解决:

1.证书过期了导致链接不上。

2.可以看到 token 已经过期重新生成一下就可以了。

 
[root@m1 .kube]# kubeadm token list
TOKEN                     TTL         EXPIRES                     USAGES                   DESCRIPTION               EXTRA GROUPS
bwa8py.ghf5s0vfsxz1d7fx   <invalid>   2022-08-01T19:06:15+08:00   authentication,signing   kubelet-bootstrap-token   system:bootstrappers:worker


相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
相关文章
|
4月前
|
关系型数据库 MySQL 数据库
Client does not support authentication protocol requested by server; consider upgrading MySQL client
Client does not support authentication protocol requested by server; consider upgrading MySQL client
|
4月前
|
Kubernetes 容器
k8s-unable to connect to the server:x509:certificates signed by unknown authority......
k8s-unable to connect to the server:x509:certificates signed by unknown authority......
233 0
|
10月前
|
SQL JavaScript 关系型数据库
Client does not support authentication protocol requested by server
Client does not support authentication protocol requested by server
67 0
|
11月前
|
文字识别
Response from backend server
Response from backend server
53 1
|
10月前
Error from server error dialing backend remote error tls internal error
Error from server error dialing backend remote error tls internal error
87 0
|
关系型数据库 MySQL 数据库
MySql错误 1251 - Client does not support authentication protocol requested by server
MySql错误 1251 - Client does not support authentication protocol requested by server
85 0
|
Android开发
Error connecting to the service protocol failed to connect to错误
Error connecting to the service protocol failed to connect to错误
|
网络安全
WARN: Establishing SSL connection without server‘s identity verification is not recommended
WARN: Establishing SSL connection without server‘s identity verification is not recommended
100 0
|
NoSQL MongoDB
运行 mongo 出现 Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed
运行 mongo 出现 Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed
869 0
运行 mongo 出现 Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed