首先发现的报错讯息:

Aug 10 15:43:53 hetu-fr-2d kubelet[1586]: E0810 15:43:53.135619    1586 controller.go:178] failed to update node lease, error: Put https://kapi-xxx-xx:6443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/node02?timeout=10s: read tcp 192.168.111.104:35660->192.168.111.100:6443: read: connection reset by peer

 Aug 10 15:43:53 hetu-fr-2d kubelet[1586]: E0810 15:43:53.135619    1586 controller.go:178] failed to update node lease, error: Put https://kapi-xxx-xx:6443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/node02?timeout=10s: read tcp 192.168.111.104:35660->192.168.111.100:6443: read: connection reset by peer

然后看k8s组件有重启现象

看apiserver的日志,发现有可能是etcd的问题,

查这个报错:watch chan error: etcdserver: mvcc: required revision has been compacted,有可能是因为ectd压缩问题,可能涉及磁盘

etcd is the Kubernetes’ backing store for all cluster data, it has a history compaction mechanism to avoid performance degradation and eventual storage space exhaustion, here are some docs on etcd repo."watch chan error: etcdserver: mvcc: required revision has been compacted" literally means the watched revision is compacted. This is working as designed, when attempts to re-establish a watch from a resourceVersion that is no longer available would prompt the caller to re-list objects and obtain a new current resourceVersion to watch from..For your comment "and When I perform "kubectl get cs" it shows "unknown" both etcd and kube-controller-manager and kube-scheduler ", what does that mean? Could you paste the output of "kubectl get cs" here?

看etcd日志:"msg":"leader failed to send out heartbeat on time; took too long, leader is overloaded likely from slow disk"

Aug 11 18:00:02 etcd-1 etcd[1592]: {"level":"warn","ts":"2021-08-11T18:00:02.888+0800","caller":"etcdserver/raft.go:390","msg":"leader failed to send out heartbeat on time; took too long, leader is overloaded likely from slow disk","to":"566bb4bcdc8f3e93","heartbeat-interval":"100ms","expected-duration":"200ms","exceeded-duration":"18.959836ms"}

报错信息主要为:

心跳检测报错主要与以下因素有关(磁盘速度、cpu性能和网络不稳定问题):

  • etcd使用了raft算法,leader会定时地给每个follower发送心跳,如果leader连续两个心跳时间没有给follower发送心跳,etcd会打印这个log以给出告警。通常情况下这个issue是disk运行过慢导致的,leader一般会在心跳包里附带一些metadata,leader需要先把这些数据固化到磁盘上,然后才能发送。写磁盘过程可能要与其他应用竞争,或者因为磁盘是一个虚拟的或者是SATA类型的导致运行过慢,此时只有更好更快磁盘硬件才能解决问题。etcd暴露给Prometheus的metrics指标walfsyncduration_seconds就显示了wal日志的平均花费时间,通常这个指标应低于10ms。

  • 第二种原因就是CPU计算能力不足。如果是通过监控系统发现CPU利用率确实很高,就应该把etcd移到更好的机器上,然后通过cgroups保证etcd进程独享某些核的计算能力,或者提高etcd的priority。

  • 第三种原因就可能是网速过慢。如果Prometheus显示是网络服务质量不行,譬如延迟太高或者丢包率过高,那就把etcd移到网络不拥堵的情况下就能解决问题。但是如果etcd是跨机房部署的,长延迟就不可避免了,那就需要根据机房间的RTT调整heartbeat-interval,而参数election-timeout则至少是heartbeat-interval的5倍。

可能是超时了,检查下etcd的配置,为默认100ms,报错显示都大于100ms

于是准备调整etcd 配置的参数重启etcd试试

加上这俩参数:
心跳保持时间
heartbeat-interval: 1000
选举超时的时间
election-timeout: 10000

附录etcd 的推荐配置以及说明

!!!注:参数key: value中key之后":" 与value之间必须有一个空格#[Member]
# This is the configuration file for the etcd server.# Human-readable name for this member.
#含义:此成员的名称。
#默认值:default
#环境变量:ETCD_NAME
#作用:此配置值作为此节点在--initial-cluster标志中列出的条目(例如,default=http://localhost:2380)引用。
#      若使用静态引导,则需要匹配标志中使用的密钥。使用发现时,每个成员必须具有唯一的名称。
#      建议使用Hostname或者machine-id。
#注意:使用发现时,每个成员必须具有唯一的名称。
name: 'ptest01'# Path to the data directory.
#含义:服务运行数据保存的路径。
#默认值:${name}.etcd
#环境变量:ETCD_DATA_DIR
#作用:设置数据保存的目录。
data-dir: /data/db/etcd# Path to the dedicated wal directory.
#含义:专用wal目录的路径。
#默认值:--data-dir的路径下
#环境变量:ETCD_WAL_DIR
#作用:独立设置wal目录,etcd会将WAL文件写入--wal-dir而不是--data-dir。独立的wal路径,有助于避免日志记录和其他IO操作之间的竞争。
wal-dir: /data/log/etcd# Number of committed transactions to trigger a snapshot to disk.
#含义:触发快照到磁盘的已提交事务数。
#默认值:100000
#环境变量:ETCD_SNAPSHOT_COUNT
#作用:指定有多少事务(transaction)被提交时,触发截取快照保存到磁盘。
snapshot-count: 10000# Time (in milliseconds) of a heartbeat interval.
#含义:心跳间隔的时间(以毫秒为单位)
#默认值:100
#环境变量:ETCD_HEARTBEAT_INTERVAL
#作用:leader 多久发送一次心跳到 followers。
heartbeat-interval: 1000# Time (in milliseconds) for an election to timeout.
#含义:选举超时的时间(以毫秒为单位)
#默认值:1000
#环境变量:ETCD_ELECTION_TIMEOUT
#作用:重新投票的超时时间,如果 follow 在该时间间隔没有收到心跳包,会触发重新投票,默认为 1000 ms。
election-timeout: 10000# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
#含义:当后端大小超过给定配额时(0默认为低空间配额),引发警报。
#默认值:0
#环境变量:ETCD_QUOTA_BACKEND_BYTES
quota-backend-bytes: 0# List of comma separated URLs to listen on for peer traffic.
#含义:和成员之间通信的地址。
#默认值:http://localhost:2380
#环境变量:ETCD_LISTEN_PEER_URLS
#作用:用于监听其他etcd member的url
#提示:域名为无效值,如http://example.com:2380为错误配置。
listen-peer-urls: http://10.122.48.232:2380# List of comma separated URLs to listen on for client traffic.
#含义:对外提供服务的地址
#默认值:http://localhost:2379
#环境变量:ETCD_LISTEN_CLIENT_URLS
#作用:对外提供服务的地址。
#提示:域名为无效值,如http://example.com:2379为错误配置。
listen-client-urls: "http://10.122.48.232:2379,https://127.0.0.1:2379"# Maximum number of snapshot files to retain (0 is unlimited).
#含义:要保留的最大快照文件数(0表示不受限制)。
#默认值:5
#环境变量:ETCD_MAX_SNAPSHOTS
#作用:
#提示:Windows上的用户默认值不受限制,建议手动清除至5。
max-snapshots: 0# Maximum number of wal files to retain (0 is unlimited).
#含义:要保留的最大wal文件数(0表示不受限制)。
#默认值:5
#环境变量:ETCD_MAX_WALS
#作用:
#提示:Windows上的用户默认值不受限制,建议手动清除至5。
max-wals: 0# Comma-separated white list of origins for CORS (cross-origin resource sharing).
#含义:逗号分隔的CORS原始白名单(跨源资源共享)
#默认值:
#环境变量:ETCD_CORS
cors:#[Clustering]
# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
#含义:该节点成员对等URL地址,且会通告群集的其余成员节点。
#默认值:http://localhost:2380
#环境变量:ETCD_INITIAL_ADVERTISE_PEER_URLS
#作用:
initial-advertise-peer-urls: http://10.122.48.232:2380# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
#含义:此成员的客户端URL列表,用于通告群集的其余部分。这些URL可以包含域名。
#默认值:http://localhost:2379
#环境变量:ETCD_ADVERTISE_CLIENT_URLS
#作用:对外公告的该节点客户端监听地址。
advertise-client-urls: http://10.122.48.232:2379# Discovery URL used to bootstrap the cluster.
#含义:用于引导群集的发现URL。
#默认值:
#环境变量:ETCD_DISCOVERY
#作用:
discovery:# Valid values include 'exit', 'proxy'
#含义:发现服务失败时的预期行为(“退出”或“代理”)。“proxy”仅支持v2 API。
#默认值:proxy
#环境变量:ETCD_DISCOVERY_FALLBACK
#作用:
discovery-fallback: 'proxy'# HTTP proxy to use for traffic to discovery service.
#含义:用于流量到发现服务的HTTP代理。
#默认值:
#环境变量:ETCD_DISCOVERY_PROXY
#作用:
discovery-proxy:# DNS domain used to bootstrap initial cluster.
#含义:DNS srv域用于引导群集。
#默认值:
#环境变量:ETCD_DISCOVERY_SRV
#作用:
discovery-srv:# Initial cluster configuration for bootstrapping.
#含义:集群中所有节点的信息。
#默认值:default=http://localhost:2380
#环境变量:ETCD_INITIAL_CLUSTER
#作用:
#注意:此处default为节点的--name指定的名字;localhost:2380为--initial-advertise-peer-urls指定的值。
initial-cluster: "ptest01=http://10.122.48.232:2380,ptest02=http://10.122.48.233:2380,ptest03=http://10.122.48.234:2380"# Initial cluster token for the etcd cluster during bootstrap.
#含义:创建集群的 token,这个值每个集群保持唯一。
#默认值:etcd-cluster
#环境变量:ETCD_INITIAL_CLUSTER_TOKEN
#作用:此配置可使重新创建集群,即使配置和之前一样,也会再次生成新的集群和节点 uuid;否则会导致多个集群之间的冲突,造成未知的错误。
initial-cluster-token: 'p-etcd-cluster'# Initial cluster state ('new' or 'existing').
#含义:初始集群状态
#默认值:new
#环境变量:ETCD_INITIAL_CLUSTER_STATE
#作用:设置new为初始静态或DNS引导期间出现的所有成员。如果将此选项设置为existing,则etcd将尝试加入现有群集。
initial-cluster-state: 'new'# Reject reconfiguration requests that would cause quorum loss.
#含义:拒绝可能导致仲裁丢失的重新配置请求。
#默认值:false
#环境变量:ETCD_STRICT_RECONFIG_CHECK
#作用:
strict-reconfig-check: false# Accept etcd V2 client requests
#含义:接受etcd V2客户端请求
#默认值:true
#环境变量:ETCD_ENABLE_V2
#作用:
#2.3 代理相关标识
#提示:--proxy配置etcd以在代理模式下运行,“proxy”仅支持v2 API。
enable-v2: true# Enable runtime profiling data via HTTP server
#含义:通过HTTP服务器启用运行时分析数据。地址位于客户端URL+"/debug/pprof/"
#默认值:false
#环境变量:
#作用:
enable-pprof: true# Valid values include 'on', 'readonly', 'off'
#含义:代理模式设置,("off", "readonly" or "on")
#默认值:off
#环境变量:ETCD_PROXY
#作用:
proxy: 'off'# Time (in milliseconds) an endpoint will be held in a failed state.
#含义:在重新考虑代理请求之前,endpoints 将处于失败状态的时间(以毫秒为单位)。
#默认值:5000
#环境变量:ETCD_PROXY_FAILURE_WAIT
#作用:
proxy-failure-wait: 5000# Time (in milliseconds) of the endpoints refresh interval.
#含义:endpoints 刷新间隔的时间(以毫秒为单位)。
#默认值:30000
#环境变量:ETCD_PROXY_REFRESH_INTERVAL
#作用:
proxy-refresh-interval: 30000# Time (in milliseconds) for a dial to timeout.
#含义:拨号超时的时间(以毫秒为单位)或0表示禁用超时
#默认值:1000
#环境变量:ETCD_PROXY_DIAL_TIMEOUT
#作用:
proxy-dial-timeout: 1000# Time (in milliseconds) for a write to timeout.
#含义:写入超时的时间(以毫秒为单位)或0以禁用超时。
#默认值:5000
#环境变量:ETCD_PROXY_WRITE_TIMEOUT
#作用:
proxy-write-timeout: 5000# Time (in milliseconds) for a read to timeout.
#含义:读取超时的时间(以毫秒为单位)或0以禁用超时。
#默认值:0
#环境变量:ETCD_PROXY_READ_TIMEOUT
#作用:
proxy-read-timeout: 0#[Security]
client-transport-security:# Path to the client server TLS cert file.#含义:客户端服务器TLS证书文件的路径。#默认值:#环境变量:ETCD_CERT_FILE#作用:cert-file:# Path to the client server TLS key file.#含义:客户端服务器TLS密钥文件的路径。#默认值:#环境变量:ETCD_KEY_FILE#作用:key-file:# Enable client cert authentication.#含义:启用客户端证书验证。#默认值:false#环境变量:ETCD_CLIENT_CERT_AUTH#作用:client-cert-auth: false# Path to the client server TLS trusted CA cert file.#含义:客户端服务器的路径TLS可信CA证书文件。#默认值:#环境变量:ETCD_TRUSTED_CA_FILE#作用:trusted-ca-file:# Client TLS using generated certificates#含义:客户端TLS使用生成的证书#默认值:false#环境变量:ETCD_AUTO_TLS#作用:auto-tls: falsepeer-transport-security:# Path to the peer server TLS cert file.#含义:对等服务器TLS证书文件的路径。这是对等流量的证书,用于服务器和客户端。#默认值:#环境变量:ETCD_PEER_CERT_FILE#作用:cert-file:# Path to the peer server TLS key file.#含义:对等服务器TLS密钥文件的路径。这是对等流量的关键,用于服务器和客户端。#默认值:#环境变量:ETCD_PEER_KEY_FILE#作用:key-file:# Enable peer client cert authentication.#含义:启用对等客户端证书验证。#默认值:false#环境变量:ETCD_PEER_CLIENT_CERT_AUTH#作用:client-cert-auth: false# Path to the peer server TLS trusted CA cert file.#含义:对等服务器TLS可信CA文件的路径。#默认值:#环境变量:ETCD_PEER_TRUSTED_CA_FILE#作用:trusted-ca-file:# Peer TLS using generated certificates.#含义:Peer TLS使用自动生成的证书#默认值:false#环境变量:ETCD_PEER_AUTO_TLS#作用:auto-tls: false# Enable debug-level logging for etcd.
#含义:将所有子包的默认日志级别设置为DEBUG。
#默认值:false(所有包的INFO)
#环境变量:ETCD_DEBUG
#作用:
debug: false含义:将单个etcd子包设置为特定的日志级别。一个例子是etcdserver=WARNING,security=DEBUG
默认值:(所有包的INFO)
环境变量:ETCD_LOG_PACKAGE_LEVELS
作用:
log-package-levels: 'etcdserver=ERROR,security=DEBUG,auth=ERROR'#含义:为结构化日志记录指定'zap'或'capnslog'。
#默认值:capnslog
#环境变量:ETCD_LOGGER
#作用:
logger: zap# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
#含义:指定'stdout'或'stderr'以跳过日志记录,即使在systemd或逗号分隔的输出目标列表下运行也是如此。
#默认值:default
#环境变量:ETCD_LOG_OUTPUT
#作用:
log-outputs: [stderr]# Force to create a new one member cluster.
#含义:强制创建新的单成员群集。它提交配置更改,强制删除集群中的所有现有成员并添加自身。需要将其设置为还原备份。
#默认值:false
#环境变量:ETCD_FORCE_NEW_CLUSTER
#作用:
force-new-cluster: false#含义:说明--auto-compaction-retention配置的基于时间保留的三种模式:periodic, revision. periodic
#默认值:periodic
#环境变量:ETCD_AUTO_COMPACTION_MODE
#作用:
auto-compaction-mode: periodic#含义:在一个小时内为mvcc键值存储的自动压实保留。0表示禁用自动压缩。
#默认值:0
#环境变量:ETCD_AUTO_COMPACTION_RETENTION
#作用:
auto-compaction-retention: "1"# Auth flags
auth-token-ttl: 3600000

记一次 controller manager and scheduler 重复重启问题分析相关推荐

  1. Kube Controller Manager 源码分析

    Kube Controller Manager 源码分析 Controller Manager 在k8s 集群中扮演着中心管理的角色,它负责Deployment, StatefulSet, Repli ...

  2. Kubernetes Controller Manager 工作原理

    原文连接:https://blog.ihypo.net/15763910382218.html 本文基于对 Kubernetes v1.16 的源码阅读,文章有一定的源码,但我会通过配图尽量描述清晰 ...

  3. k8s学习笔记(10)--- kubernetes核心组件之controller manager详解

    kubernetes核心组件之controller manager详解 一.Controller Manager简介 1.1 Replication Controller 1.2 Node Contr ...

  4. Kubernetes源码阅读笔记——Controller Manager(之三)

    前一篇文章中,我们探索了Informer工作的大致逻辑,提到了添加回调函数部分包含了三块,即:Informer的创建.函数调用的逻辑.以及回调函数本身.前两块已在前文谈到过,下面我们来看看第三块,即回 ...

  5. kubernetes 核心组件之 Controller Manager

    文章目录 Controller Manager 简介 Controller Manager 架构设计 Reflactor Informer Controller Replication Control ...

  6. 【重识云原生】第六章容器6.3.5节——Controller Manager概述

    <重识云原生系列>专题索引: 第一章--不谋全局不足以谋一域 第二章计算第1节--计算虚拟化技术总述 第二章计算第2节--主流虚拟化技术之VMare ESXi 第二章计算第3节--主流虚拟 ...

  7. Kubernetes核心原理(二)之Controller Manager

    本文个人博客地址:http://www.huweihuang.com/article/kubernetes/core-principle/kubernetes-core-principle-contr ...

  8. k8s配置Controller Manager出错

    请问有人知道启动配置Controller Manager文件为 [Unit] Description=Kubernetes Controller Manager Documentation=https ...

  9. Fake Controller Manager 基础

    Fake Controller Manager http://docs.ros.org/kinetic/api/moveit_tutorials/html/doc/fake_controller_ma ...

最新文章

  1. Fedora 从 15.0 开始将修改以太网卡命名规则
  2. 一个用于 Entity Framework 对象拷贝的方法
  3. 《统计自然语言处理》读书笔记 一.基础知识及概念介绍
  4. Angular源代码里字母Theta的含义
  5. Git 添加空文件夹的方法
  6. php项目私有化部署保护代码,ThinkPHP项目安全配置解决方案
  7. php psl标准,psl是什么单位
  8. 消除blur属性的边框
  9. 【车道线检测与寻迹】4月17 【多方内容总结】大模块:车辆检测,车道线检测,车辆压线判别
  10. 古代皇帝的某祖某宗,有什么讲究
  11. JavaSwing订餐管理系统
  12. Vue+ElementUI实现简单的用户管理系统(四):查看用户详情页及删除用户
  13. 誉天华为数通认证技术指南之BGP的前世今生
  14. android慢快门相机,慢快门app-Slow Shutter Cam官网版(附教程)预约 _5577安卓网
  15. 用电脑自带的“画图”调整图片大小到100K以下
  16. 大型网络游戏服务器的框架设计(一)
  17. 浅谈数据库用户表结构设计,第三方登录
  18. 通信接口:RS-232 / RS-422 / RS-485三者概述与区别
  19. tyler cowen_Codenvy背后的技术。 首席执行官Tyler Jewell访谈
  20. Windows XP \Windows 2003启动过程的学习及故障分析处理(六c)

热门文章

  1. python3.7通过itchat方式登录微信给好友发送天气信息
  2. 小木虫好中的ei期刊图像处理
  3. c语言考试考点,C语言考点精选
  4. Python 保存图片的两种方法
  5. docker: error pulling image configuration:timeout
  6. 【Reactome 下载所有通路基因集】
  7. Windows10优化系统,优化达到30多项,速度大幅提升,
  8. Stm32F4x采用外部触发法测矩形波频率和占空比
  9. 直击|支付宝还信用卡下月开始收费 每月2000免费额度
  10. 网络最大流模板(标号法)