【发布时间】:2019-07-22 23:19:55
【问题描述】:
我已经在 kubernetes 中指定了一个部署:
apiVersion: v1
kind: List
items:
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: quote-data
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
run: quote-data
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
run: quote-data
spec:
containers:
- image: quote-data:2
imagePullPolicy: Always
name: quote-data
readinessProbe:
httpGet:
path: /api/data/health
port: 5000
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 1
successThreshold: 1
ports:
- containerPort: 5000
protocol: TCP
我们可以使用 readinessprobe 禁用此 pod 的流量(在启动阶段后几分钟)吗?
在我的测试中,即使 readinessprobe 失败,服务(类型:LoadBalancer)也会继续在坏 pod 上发送流量。在服务中,pod 的 Ready 状态 = false 但服务仍然继续在错误的 pod 上发送
更新: 它似乎适用于卷曲,但不适用于邮递员。 我使用简单的 curl 命令在两个请求之间有一个不同的 pod。 我总是和 Postman 同一个 pod
【问题讨论】:
-
您好,您可以增加 initialDelaySeconds,因此 kubelet 将在该秒数之前进行第一次探测。
-
您是否尝试过包含 liveness probe 以检查进一步的行为?
-
我找到了我的问题的解释。事实上,postman 使用 htttp1.1 协议保持一个开放的 http 连接
标签: kubernetes