【问题标题】:Kubernetes health check outside container容器外的 Kubernetes 健康检查
【发布时间】:2018-11-30 11:50:05
【问题描述】:

我可以从容器外进行活性或就绪类型的健康检查吗?我的意思是,如果无法访问应用程序,我可以停止到 pod 的流量并重新启动容器吗?

【问题讨论】:

    标签: kubernetes kubernetes-health-check


    【解决方案1】:

    Http Request Liveness Probe 和 TCP Liveness Probe 可用于查看在容器内运行的应用程序是否可以从外部访问:

    pods/probe/http-liveness.yaml
    
    apiVersion: v1
    kind: Pod
    metadata:
      labels:
        test: liveness
      name: liveness-http
    spec:
      containers:
      - name: liveness
        image: k8s.gcr.io/liveness
        args:
        - /server
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
            httpHeaders:
            - name: X-Custom-Header
              value: Awesome
          initialDelaySeconds: 3
          periodSeconds: 3
    

    this piece of documentation on configuring probes。这能回答你的问题吗?

    【讨论】:

      猜你喜欢
      • 2022-08-04
      • 1970-01-01
      • 2020-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-06
      • 2021-06-15
      • 1970-01-01
      相关资源
      最近更新 更多