请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

根据glusterfs-daemonset.yaml创建Pod,健康检查不通过

老师您好,我根据视频中的glusterfs-daemonset.yaml文件创建pod的时候,健康检查不通过,下面是错误信息:
图片描述
然后glusterfs-daemonset.yaml文件我就改了下面两处,其它都和老师提供的内容是一样的:
图片描述

说明:之所以要改上面那两处,是因为我安装的k8s版本比视频中的高,不改的话使用kubectl apply -f命令基于yaml文件创建资源的时候会报错。

然后我进入容器中把健康检查涉及到的status-probe.sh脚本也拿出来了,内容如下:

#!/bin/bash
#
# Return overall status of the glusterfs container
#

require() {
    if ! "$@" ; then
        echo "failed check: $*" >&2
        exit 1
    fi
}

filesystem_used_under_limit() {
    path="$1"
    max_used="$2"
    curr_used="$(df --output=pcent "$path" | tail -n1  | awk '{print $1}')"
    curr_used="${curr_used%?}"
    [[ "$curr_used" -lt "$max_used" ]]
}

mode="$1"
case "$mode" in
    -h|--help|help)
        echo "Return overall container status"
        echo "    $0 [readiness|liveness]"
        exit 0
    ;;
    # currently the liveness and readiness check is the same
    # it does not always have to be this way
    ready|readiness|live|liveness|"")
        if [[ -z "$mode" ]] ; then
            echo "warning: no mode provided. Assuming liveness probe" >&2
        fi
        require systemctl -q is-active glusterd.service
        
        if [[ "$GLUSTER_BLOCKD_STATUS_PROBE_ENABLE" -eq 1 ]]; then
            require systemctl -q is-active gluster-blockd.service
        fi

        require filesystem_used_under_limit "/var/lib/glusterd" 99
    ;;
    *)
        echo "error: unknown mode $mode" >&2
        exit 2
    ;;
esac

然后我这边glusterfs相关的三台worker节点上glusterd服务也都是正常运行的:
图片描述
图片描述
图片描述

正在回答 回答被采纳积分+3

1回答

刘果国 2021-07-16 08:55:42

进入容器执行一下完整的命令试试,看看退出值是不是0

systemctl -q is-active glusterd.service


0 回复 有任何疑惑可以回复我~
  • 提问者 龙战GT #1
    感谢老师,已经解决了,自己环境的问题。部署glusterfs的三个worker节点在加入k8s集群前,为了测试目录挂载,装过glusterfs集群,估计是有什么冲突,重新找三个新节点加入k8s中进行测试就没问题了。
    回复 有任何疑惑可以回复我~ 2021-07-16 10:15:34

相似问题

登录后可查看更多问答,登录/注册

问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号