In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to solve the failure problem of systemctl status probe in Kubernetes pod". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
In Heketi's glusterd container service, the systemctl probe is used to detect whether the glusterfs service is available, and it is always found that there is a failure problem.
It is found that the output information of systemctl status glusterd.service runtime on Ubuntu 18.04 is not what K8s livenessProbe expects, resulting in a timeout hang of the detector.
Using systemctl status glusterd.service can not detect the real status of the service, it will suspend, time out, and return an error status code.
The true state of service can be correctly detected in the following ways:
Systemctl is-active-- quiet glusterd.service; echo $?
Or (similar):
Systemctl is-active sshd > / dev/null 2 > & 1 & & echo 0 | | echo 1
Output:
Normal time 0
The error code is abnormal.
As follows:
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 $?
The modified k8s yaml file is as follows:
ApiVersion: apps/v1kind: DaemonSetmetadata: name: glusterfs-daemon namespace: gluster labels: k8s-app: glusterfs-nodespec: 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
There may be different versions of systemd and different parameters on different versions of Linux. Enter systemctl help to get help from the current version.
This is the end of the content of "how to solve the failure of systemctl status probe in Kubernetes pod". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.