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

简介: 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


相关实践学习
深入解析Docker容器化技术
Docker是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化,容器是完全使用沙箱机制,相互之间不会有任何接口。Docker是世界领先的软件容器平台。开发人员利用Docker可以消除协作编码时“在我的机器上可正常工作”的问题。运维人员利用Docker可以在隔离容器中并行运行和管理应用,获得更好的计算密度。企业利用Docker可以构建敏捷的软件交付管道,以更快的速度、更高的安全性和可靠的信誉为Linux和Windows Server应用发布新功能。 在本套课程中,我们将全面的讲解Docker技术栈,从环境安装到容器、镜像操作以及生产环境如何部署开发的微服务应用。本课程由黑马程序员提供。 &nbsp; &nbsp; 相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
相关文章
|
网络协议 Shell Linux
【Shell 命令集合 网络通讯 】Linux 创建网络连接 nc命令 使用教程
【Shell 命令集合 网络通讯 】Linux 创建网络连接 nc命令 使用教程
605 1
|
SQL 监控 网络协议
线上故障如何快速排查?来看这套技巧大全
有哪些常见的线上故障?如何快速定位问题?本文详细总结工作中的经验,从服务器、Java应用、数据库、Redis、网络和业务六个层面分享线上故障排查的思路和技巧。较长,同学们可收藏后再看。
线上故障如何快速排查?来看这套技巧大全
|
Kubernetes 搜索推荐 网络协议
使用 kubeadm 部署 Kubernetes 集群(三)kubeadm 初始化 k8s 证书过期解决方案
使用 kubeadm 部署 Kubernetes 集群(三)kubeadm 初始化 k8s 证书过期解决方案
994 8
|
9月前
|
存储 前端开发 数据可视化
Grafana Loki,轻量级日志系统
本文介绍了基于Grafana、Loki和Alloy构建的轻量级日志系统。Loki是一个由Grafana Labs开发的日志聚合系统,具备高可用性和多租户支持,专注于日志而非指标,通过标签索引而非内容索引实现高效存储。Alloy则是用于收集和转发日志至Loki的强大工具。文章详细描述了系统的架构、组件及其工作流程,并提供了快速搭建指南,包括准备步骤、部署命令及验证方法。此外,还展示了如何使用Grafana查看日志,以及一些基本的LogQL查询示例。最后,作者探讨了Loki架构的独特之处,提出了“巨型单体模块化”的概念,即一个应用既可单体部署也可分布式部署,整体协同实现全部功能。
3355 70
Grafana Loki,轻量级日志系统
|
jenkins 持续交付
Jenkins 问题 No such plugin: cloudbees-folder
Jenkins 问题 No such plugin: cloudbees-folder
842 0
|
存储 运维 Linux
如何在 Linux 系统中使用 envsubst 命令替换环境变量?
`envsubst` 是 Linux 系统中用于替换文本中环境变量值的实用工具。本文分三部分介绍其工作原理、使用方法及实际应用,包括配置文件替换、脚本执行中环境变量替换和动态生成文件等场景,帮助用户高效利用 `envsubst` 进行开发和运维工作。
610 4
|
Kubernetes 持续交付 Docker
SpringCloud + K8S:容器化持续交付的强大组合
【8月更文挑战第22天】在当今快速迭代的软件开发环境中,如何高效、可靠地部署和管理微服务架构应用成为了技术团队面临的重大挑战。SpringCloud与Kubernetes(K8S)的结合,为微服务架构的容器化持续交付提供了强大的解决方案,极大地提升了应用的可扩展性、灵活性和可维护性。本文将从技术角度深入探讨这一组合的优势及其在工作学习中的实践应用。
819 3
|
Docker 容器
docker设置国内镜像源
docker设置国内镜像源
37242 5
|
存储 关系型数据库 MySQL
四种数据库对比MySQL、PostgreSQL、ClickHouse、MongoDB——特点、性能、扩展性、安全性、适用场景
四种数据库对比 MySQL、PostgreSQL、ClickHouse、MongoDB——特点、性能、扩展性、安全性、适用场景
|
Kubernetes 容器
934.【kubernetes】kubeadm版本更新证书
934.【kubernetes】kubeadm版本更新证书
670 2