IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> kube-admin和kube-scheduler总是莫名的重启,集群状态还ok,没有问题 -> 正文阅读

[系统运维]kube-admin和kube-scheduler总是莫名的重启,集群状态还ok,没有问题

看截图信息

# kubectl  get po -n kube-system
NAME                                        READY   STATUS    RESTARTS       AGE
coredns-6d8c4cb4d-8xghq                     1/1     Running   0              38m
coredns-6d8c4cb4d-q65vq                     1/1     Running   0              38m
etcd-host-10-19-83-151                      1/1     Running   4              23h
kube-apiserver-master                       1/1     Running   1              23h
kube-controller-manager-master              1/1     Running   31 (25m ago)   23h
kube-flannel-ds-amd64-2pwps                 1/1     Running   0              61m
kube-flannel-ds-amd64-svfg6                 1/1     Running   0              61m
kube-flannel-ds-amd64-xmppt                 1/1     Running   1              61m
kube-proxy-d4bb2                            1/1     Running   0              23h
kube-proxy-k2skv                            1/1     Running   1              23h
kube-proxy-x9k76                            1/1     Running   1 (23h ago)    23h
kube-scheduler-master                       1/1     Running   32 (25m ago)   23h

查看详细信息后发现,探针一直有探测失败的情况

# kubectl describe po kube-controller-manager-master -n kube-system
Name:                 kube-controller-manager-master
Namespace:            kube-system
Priority:             2000001000
Priority Class Name:  system-node-critical
......
Events:
  Type     Reason     Age                  From     Message
  ----     ------     ----                 ----     -------
  Normal   Pulled     84m (x6 over 5h36m)  kubelet  Container image "registry.aliyuncs.com/google_containers/kube-controller-manager:v1.23.4" already present on machine
  Normal   Created    84m (x6 over 5h36m)  kubelet  Created container kube-controller-manager
  Normal   Started    84m (x6 over 5h36m)  kubelet  Started container kube-controller-manager
  Warning  Unhealthy  33m                  kubelet  Liveness probe failed: Get "https://127.0.0.1:10257/healthz": read tcp 127.0.0.1:59840->127.0.0.1:10257: read: connection reset by peer
  Normal   Pulled     33m (x4 over 44m)    kubelet  Container image "registry.aliyuncs.com/google_containers/kube-controller-manager:v1.23.4" already present on machine
  Normal   Created    32m (x4 over 44m)    kubelet  Created container kube-controller-manager
  Normal   Started    32m (x4 over 44m)    kubelet  Started container kube-controller-manager
  Warning  BackOff    30m (x11 over 43m)   kubelet  Back-off restarting failed container
  Warning  Unhealthy  28m (x4 over 43m)    kubelet  Liveness probe failed: Get "https://127.0.0.1:10257/healthz": dial tcp 127.0.0.1:10257: connect: connection refused

依次检查cs,没有发现问题

# kubectl get cs 
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME                 STATUS    MESSAGE                         ERROR
scheduler            Healthy   ok                              
controller-manager   Healthy   ok                              
etcd-0               Healthy   {"health":"true","reason":""}   

修改kube-controller-manager.yaml文件

containers:
  - command:
    - kube-controller-manager
    - --allocate-node-cidrs=true
    - --authentication-kubeconfig=/etc/kubernetes/controller-manager.conf
    - --authorization-kubeconfig=/etc/kubernetes/controller-manager.conf
    - --bind-address=127.0.0.1
    - --client-ca-file=/etc/kubernetes/pki/ca.crt
    - --cluster-cidr=10.244.0.0/16
    - --cluster-name=kubernetes
    - --cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt
    - --cluster-signing-key-file=/etc/kubernetes/pki/ca.key
    - --controllers=*,bootstrapsigner,tokencleaner
    - --kubeconfig=/etc/kubernetes/controller-manager.conf
    - --leader-elect=true
    - --requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt
    - --root-ca-file=/etc/kubernetes/pki/ca.crt
    - --service-account-private-key-file=/etc/kubernetes/pki/sa.key
    - --service-cluster-ip-range=10.96.0.0/12
    - --use-service-account-credentials=true
    - --address=127.0.0.1                #添加这条信息
    image: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.23.4
    imagePullPolicy: IfNotPresent

修改kube-scheduler.yaml文件

spec:
  containers:
  - command:
    - kube-scheduler
    - --authentication-kubeconfig=/etc/kubernetes/scheduler.conf
    - --authorization-kubeconfig=/etc/kubernetes/scheduler.conf
    - --bind-address=127.0.0.1
    - --kubeconfig=/etc/kubernetes/scheduler.conf
    - --leader-elect=true
    - --address=127.0.0.1   #添加此行
    image: registry.aliyuncs.com/google_containers/kube-scheduler:v1.23.4
    imagePullPolicy: IfNotPresent

修改完以后,再重新启动

# kubectl delete -f kube-controller-manager.yaml 
Error from server (NotFound): error when deleting "kube-controller-manager.yaml": pods "kube-controller-manager" not found

# kubectl delete -f kube-scheduler.yaml 
Error from server (NotFound): error when deleting "kube-scheduler.yaml": pods "kube-scheduler" not found

# kubectl apply -f kube-scheduler.yaml       
pod/kube-scheduler created

# kubectl apply -f kube-controller-manager.yaml 
pod/kube-controller-manager created

?查看po的日志信息,看日志信息,貌似加入 -address参数,也没有作用,但是问题确实是解决了。这个报错,因为只有一个master,此时,master运行到了其他的node节点上,故目录下没有相应的文件,删掉,指定运行在master主机上即可

# kubectl  logs  kube-controller-manager -n kube-system   
Flag --address has been deprecated, This flag has no effect now and will be removed in v1.24.
I0310 09:01:13.528382       1 serving.go:348] Generated self-signed cert in-memory
unable to create request header authentication config: open /etc/kubernetes/pki/front-proxy-ca.crt: no such file or directory

再次检查,暂时没有重启,在继续观察,是否还会重启

# kubectl get pod -n kube-system -o wide
NAME                                        READY   STATUS    RESTARTS      AGE   IP             NODE                NOMINATED NODE   READINESS GATES
coredns-6d8c4cb4d-8xghq                     1/1     Running   0             73m   10.244.2.186   node2   			 <none>           <none>
coredns-6d8c4cb4d-q65vq                     1/1     Running   0             73m   10.244.1.49    node1   			 <none>           <none>
etcd-master                      			1/1     Running   4 (77m ago)   24h   10.19.83.151   master  			 <none>           <none>
kube-apiserver-master            			1/1     Running   1 (77m ago)   24h   10.19.83.151   master  			 <none>           <none>
kube-controller-manager-master   			1/1     Running   0             13m   10.19.83.151   master  			 <none>           <none>
kube-flannel-ds-amd64-2pwps                 1/1     Running   0             96m   10.19.83.154   node2   			 <none>           <none>
kube-flannel-ds-amd64-svfg6                 1/1     Running   0             96m   10.19.83.153   node1   			 <none>           <none>
kube-flannel-ds-amd64-xmppt                 1/1     Running   1 (77m ago)   96m   10.19.83.151   master  			 <none>           <none>
kube-proxy-d4bb2                            1/1     Running   0             24h   10.19.83.154   node2   			 <none>           <none>
kube-proxy-k2skv                            1/1     Running   1             24h   10.19.83.151   master  			 <none>           <none>
kube-proxy-x9k76                            1/1     Running   1 (24h ago)   24h   10.19.83.153   node1   			 <none>           <none>
kube-scheduler                              1/1     Running   0             10m   10.19.83.153   node1   			 <none>           <none>
kube-scheduler-master            			1/1     Running   0             11m   10.19.83.151   master  			 <none>           <none>

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2022-03-11 22:36:33  更:2022-03-11 22:37:30 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/16 2:28:54-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码