我在kubernetes-1.12.6上使用pod准备门,就像这个https://v1-12.docs.kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate
但它不像文件那样工作
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
run: tomcat
name: tomcat
namespace: default
spec:
selector:
matchLabels:
run: tomcat
template:
metadata:
labels:
run: tomcat
spec:
containers:
- image: tomcat
name: tomcat
readinessGates:
- conditionType: www.example.com/feature-1
restartPolicy: Always
我想要一个状态如下的吊舱
Kind: Pod
...
spec:
readinessGates:
- conditionType: "www.example.com/feature-1"
status:
conditions:
- type: Ready # this is a builtin PodCondition
status: "True"
lastProbeTime: null
lastTransitionTime: 2018-01-01T00:00:00Z
- type: "www.example.com/feature-1" # an extra PodCondition
status: "False"
lastProbeTime: null
lastTransitionTime: 2018-01-01T00:00:00Z
containerStatuses:
- containerID: docker://abcd...
ready: true
...
但我的吊舱的状态是这样的
status:
conditions:
- lastProbeTime: null
lastTransitionTime: "2019-04-27T14:59:00Z"
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: "2019-04-27T14:59:00Z"
message: corresponding condition of pod readiness gate "www.example.com/feature-1"
does not exist.
reason: ReadinessGatesNotReady
status: "False"
type: Ready
为什么?
根据readinessGates description,pod外部的一些逻辑似乎必须更新此状态字段。由用户来实现这样的逻辑。
创建pod后,只要Podtypec中存在ReadinessGate,每个功能都负责保持其自定义pod条件同步。这可以通过运行k8s控制器来同步相关pod上的条件来实现。