水上冰石 2022-08-05 18:44 采纳率: 0%
浏览 1119
已结题

etcd发现错误: kubelet, k8smaster Liveness probe failed: HTTP probe failed with statuscode: 503

问题遇到的现象和发生背景

树莓派arm64版本用kubeadm方式部署k8s,一切正常,不过查看etcd的时候,发现错误:

 有错误503: 


###### 问题相关代码,请勿粘贴截图 


```bash
[root@k8smaster ~]# kubectl describe pods etcd-k8smaster  -n kube-system





###### 运行结果及报错内容 



```bash
Name:                 etcd-k8smaster
Namespace:            kube-system
Priority:             2000000000
Priority Class Name:  system-cluster-critical
Node:                 k8smaster/192.168.0.200
Start Time:           Fri, 05 Aug 2022 14:19:59 +0800
Labels:               component=etcd
                      tier=control-plane
Annotations:          kubeadm.kubernetes.io/etcd.advertise-client-urls: https://192.168.0.200:2379
                      kubernetes.io/config.hash: 20226498f18eda5486f418f7d909e916
                      kubernetes.io/config.mirror: 20226498f18eda5486f418f7d909e916
                      kubernetes.io/config.seen: 2022-07-28T17:58:49.915164955+08:00
                      kubernetes.io/config.source: file
Status:               Running
IP:                   192.168.0.200
IPs:
  IP:           192.168.0.200
Controlled By:  Node/k8smaster
Containers:
  etcd:
    Container ID:  docker://b013638179154125b2fa23a54dd4a923f8c37a2adcbc4e4acc93101b6222e148
    Image:         registry.aliyuncs.com/google_containers/etcd:3.4.3-0
    Image ID:      docker-pullable://registry.aliyuncs.com/google_containers/etcd@sha256:4afb99b4690b418ffc2ceb67e1a17376457e441c1f09ab55447f0aaf992fa646
    Port:          <none>
    Host Port:     <none>
    Command:
      etcd
      --advertise-client-urls=https://192.168.0.200:2379
      --cert-file=/etc/kubernetes/pki/etcd/server.crt
      --client-cert-auth=true
      --data-dir=/var/lib/etcd
      --initial-advertise-peer-urls=https://192.168.0.200:2380
      --initial-cluster=k8smaster=https://192.168.0.200:2380
      --key-file=/etc/kubernetes/pki/etcd/server.key
      --listen-client-urls=https://127.0.0.1:2379,https://192.168.0.200:2379
      --listen-metrics-urls=http://127.0.0.1:2381
      --listen-peer-urls=https://192.168.0.200:2380
      --name=k8smaster
      --peer-cert-file=/etc/kubernetes/pki/etcd/peer.crt
      --peer-client-cert-auth=true
      --peer-key-file=/etc/kubernetes/pki/etcd/peer.key
      --peer-trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
      --snapshot-count=10000
      --trusted-ca-file=/etc/kubernetes/pki/etcd/ca.crt
    State:          Running
      Started:      Fri, 05 Aug 2022 14:20:04 +0800
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 04 Aug 2022 10:12:17 +0800
      Finished:     Fri, 05 Aug 2022 14:19:02 +0800
    Ready:          True
    Restart Count:  18
    Liveness:       http-get http://127.0.0.1:2381/health delay=15s timeout=15s period=10s #success=1 #failure=8
    Environment:    <none>
    Mounts:
      /etc/kubernetes/pki/etcd from etcd-certs (rw)
      /var/lib/etcd from etcd-data (rw)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  etcd-certs:
    Type:          HostPath (bare host directory volume)
    Path:          /etc/kubernetes/pki/etcd
    HostPathType:  DirectoryOrCreate
  etcd-data:
    Type:          HostPath (bare host directory volume)
    Path:          /var/lib/etcd
    HostPathType:  DirectoryOrCreate
QoS Class:         BestEffort
Node-Selectors:    <none>
Tolerations:       :NoExecute
Events:
  Type     Reason     Age                   From                Message
  ----     ------     ----                  ----                -------
  Warning  Unhealthy  53s (x46 over 3h55m)  kubelet, k8smaster  Liveness probe failed: HTTP probe failed with statuscode: 503

错误:






###### 我的解答思路和尝试过的方法 


[root@k8smaster ~]#  kubectl get all -o wide



```bash
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE   SELECTOR
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   8d    <none>

我想要达到的结果

etcd 探测可以显示正常

  • 写回答

1条回答 默认 最新

  • 优质网络系统领域创作者 网络领域新星创作者 2022-08-10 08:19
    关注

    原来是liveness probe(存活探针)报错,观察yaml文件:
    ……
    livenessProbe:
    failureThreshold: 3
    httpGet:
    path: /
    port: 1880
    scheme: HTTP
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 1
    ……
    而应用中没有对GET请求的处理,所以会出错,删除yaml文件中的livenessProbe相关配置,重启部署解决。

    评论

报告相同问题?

问题事件

  • 系统已结题 8月13日
  • 创建了问题 8月5日

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀