【发布时间】:2018-08-16 04:49:09
【问题描述】:
我在statefulset.yml中使用以下代码
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: geth
namespace: prod
spec:
serviceName: geth-service
replicas: 2
selector:
matchLabels:
app: geth-node
template:
metadata:
labels:
app: geth-node
spec:
containers:
- name: geth-node
image: <My image>
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /
port: 8545
initialDelaySeconds: 20 #wait this period after staring fist time
periodSeconds: 15 # polling interval
timeoutSeconds: 5 # wish to receive response within this time period
readinessProbe:
httpGet:
path: /
port: 8545
initialDelaySeconds: 20 #wait this period after staring fist time
periodSeconds: 15 # polling interval
timeoutSeconds: 5
我的ingress.yml中有以下内容
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: prod-ingress
namespace: prod
annotations:
kubernetes.io/ingress.class: "gce"
kubernetes.io/ingress.global-static-ip-name: "mystaticip"
spec:
tls:
- secretName: my-tls
hosts:
- myhost.com
rules:
- host: myhost
http:
paths:
- path: /rpc
backend:
serviceName: gethrpc-service
servicePort: 80
我的容器暴露了端口8545,所以我为statefulset配置了上面的探针。
当我创建这个 statefulset 和 ingress 时,会自动创建一个负载均衡器。
我有两个后端服务(我认为两个节点的两个端口 - 我在两个节点上运行它)
但是,我对为这些后端服务创建的以下两个运行状况检查感到困惑。
1. Path: /healthz Port number: 30695
2. Path: / Port number: 30190
- 我不明白为什么这些健康检查对于不同的节点是不同的。
- 我将路径配置为
/,所以 IMO 都应该有路径/
PS:我正在运行一个两节点集群和 2 个 Pod,每个节点上一个。
【问题讨论】:
标签: google-kubernetes-engine kubernetes-health-check