在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

Kubernetes pod中systemctl状态探针失败问题怎么解决

137次阅读
没有评论

共计 2941 个字符,预计需要花费 8 分钟才能阅读完成。

本篇内容介绍了“Kubernetes pod 中 systemctl 状态探针失败问题怎么解决”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让丸趣 TV 小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

在 Heketi 的 glusterd 容器服务,使用 systemctl 探针来检测 glusterfs 服务是否可用,发现总是出现失败问题。

经查,在 Ubuntu 18.04 上 systemctl status glusterd.service 运行时输出信息不是 K8s livenessProbe 希望的,导致检测器超时挂起了。

使用 systemctl status glusterd.service 并不能检测到服务的真实状态,会挂起、超时,返回错误状态码。

使用下面的方式,可以正确检测 service 的真实状态: 

systemctl is-active --quiet glusterd.service; echo $?;

或者(类似于):

systemctl is-active sshd  /dev/null 2 1   echo 0 || echo 1

输出:

正常时 0;

非正常时为错误码。

如下所示:

 livenessProbe:
 exec:
 command:
 - /bin/bash
 - -c
 - systemctl is-active --quiet glusterd.service; echo $?;
 failureThreshold: 3
 initialDelaySeconds: 60
 periodSeconds: 10
 successThreshold: 1
 timeoutSeconds: 3
 readinessProbe:
 exec:
 command:
 - /bin/bash
 - -c
 - systemctl is-active --quiet glusterd.service; echo $?;

修改后的 k8s yaml 文件如下:

apiVersion: apps/v1
kind: DaemonSet
metadata:
 name: glusterfs-daemon
 namespace: gluster
 labels:
 k8s-app: glusterfs-node
spec:
 selector:
 matchLabels:
 name: glusterfs-daemon
 template:
 metadata:
 labels:
 name: glusterfs-daemon
 spec:
 tolerations:
 - key: node-role.kubernetes.io/master
 effect: NoSchedule
 containers:
 - image: gluster/gluster-centos:latest
 imagePullPolicy: IfNotPresent
 name: glusterfs
 livenessProbe:
 exec:
 command:
 - /bin/bash
 - -c
 - systemctl is-active --quiet glusterd.service; echo $?;
 failureThreshold: 3
 initialDelaySeconds: 60
 periodSeconds: 10
 successThreshold: 1
 timeoutSeconds: 3
 readinessProbe:
 exec:
 command:
 - /bin/bash
 - -c
 - systemctl is-active --quiet glusterd.service; echo $?;
 failureThreshold: 3
 initialDelaySeconds: 60
 periodSeconds: 10
 successThreshold: 1
 timeoutSeconds: 3
 resources: {}
 securityContext:
 capabilities: {}
 privileged: true
 terminationMessagePath: /dev/termination-log
 terminationMessagePolicy: File
 volumeMounts:
 - mountPath: /var/lib/heketi
 name: glusterfs-heketi
 - mountPath: /run
 name: glusterfs-run
 - mountPath: /run/lvm
 name: glusterfs-lvm
 - mountPath: /etc/glusterfs
 name: glusterfs-etc
 - mountPath: /var/log/glusterfs
 name: glusterfs-logs
 - mountPath: /var/lib/glusterd
 name: glusterfs-config
 - mountPath: /dev
 name: glusterfs-dev
 - mountPath: /sys/fs/cgroup
 name: glusterfs-cgroup
 dnsPolicy: ClusterFirst
 hostNetwork: true
 restartPolicy: Always
 schedulerName: default-scheduler
 securityContext: {}
 terminationGracePeriodSeconds: 30
 volumes:
 - hostPath:
 path: /var/lib/heketi
 type:  
 name: glusterfs-heketi
 - emptyDir: {}
 name: glusterfs-run
 - hostPath:
 path: /run/lvm
 type:  
 name: glusterfs-lvm
 - hostPath:
 path: /etc/glusterfs
 type:  
 name: glusterfs-etc
 - hostPath:
 path: /var/log/glusterfs
 type:  
 name: glusterfs-logs
 - hostPath:
 path: /var/lib/glusterd
 type:  
 name: glusterfs-config
 - hostPath:
 path: /dev
 type:  
 name: glusterfs-dev
 - hostPath:
 path: /sys/fs/cgroup
 type:  
 name: glusterfs-cgroup

可能在不同的 Linux 版本上,systemd 的版本不同,参数也可能不一样,输入 systemctl help 来获取当前版本的帮助。

“Kubernetes pod 中 systemctl 状态探针失败问题怎么解决”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注丸趣 TV 网站,丸趣 TV 小编将为大家输出更多高质量的实用文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-08-16发表,共计2941字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 国产全黄a一级毛片视频 | 亚洲第一性网站 | 国产精品欧美视频另类专区 | 亚洲熟妇av一区二区三区 | 色版视频在线观看 | 亚洲成在人天堂在线 | 亚洲一区二区在线播放 | 久久国产毛片 | 在线观看精品国产 | 成人小视频免费观看 | 免费一级片在线观看 | 久久99精品久久久久久噜噜 | 亚洲色图激情小说 | 亚洲人成亚洲精品 | 日本三线免费视频观看 | 欧洲丰满少妇做爰视频爽爽 | 99免费在线| 久久久久国产成人精品 | 成人午夜大片免费视频77777 | www.俺来也.com | 欧美人妻一区二区三区 | 996热精品视频在线观看 | 国产美女久久 | 久久久久久曰本av免费免费 | 免费一级欧美毛片 | 四虎影院免费视频 | 亚洲国产欧美自拍 | 美国高清美女做性视频 | 成人福利视频 | 成人午夜无人区一区二区 | 亚洲男人天堂a | 久久亚洲国产成人亚 | 欧美人与动牲交zooz乌克兰 | 91九色视频在线观看 | 国产内射老熟女aaaa∵ | 国外亚洲成av人片在线观看 | 国产精品久久人妻无码网站一区 | 久久久免费视频观看 | 精品人妻码一区二区三区 | 男人的天堂av社区在线 | 四虎4hu永久在线观看 |