fabric8-maven-plugin 为 initcontainers 生成 livenessProbe 和 readinessProbe,部署失败
fabric8-maven-plugin generates livenessProbe and readinessProbe for initcontainers and deployment fails
我在 deployment.yml 中使用 initContainers 并使用 fabric8-maven-plugin 将应用程序部署到 openshift。
initContainers 片段来自 deployment.yml
spec:
template:
spec:
volumes:
- emptyDir: {}
name: work-dir
containers:
- name: hello-world
resources:
requests:
cpu: "0.2"
# memory: 256Mi
limits:
cpu: "1.0"
# memory: 256Mi
volumeMounts:
- mountPath: /var/work-dir
name: work-dir
initContainers:
- args:
- -c
command:
- /bin/bash
image: docker-registry.default.svc:5000/openshift/rhel-openssl-keytool
imagePullPolicy: Always
name: init-hello-world
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/work-dir
name: work-dir
f-m-p生成的openshift.yml将livenessProbe和readinessProbe添加到无效的initContainers中。
生成的 DC:
initContainers:
- args:
- -c
command:
- /bin/bash
image: docker-registry.default.svc:5000/openshift/rhel-openssl-keytool
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 180
name: init-hello-world
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 10
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/work-dir
name: work-dir
部署 (mvn fabric8:deploy
) 失败并显示 "io.fabric8.kubernetes.client.KubernetesClientException spec.template.spec.initContainers[0].livenessProbe: Invalid value:"
[INFO] Updating DeploymentConfig from openshift.yml
[ERROR] Failed to update DeploymentConfig from openshift.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PUT at: https
://openshifthost.com/deploymentconfigs/sample-project. Message: Deployment
Config "sample-project" is invalid: [spec.template.spec.initContainers[0].livenessProbe: Invalid value: api.Probe{Handler:api.Handler{Ex
ec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7340), TCPSocket:(*api.TCPSocketAction)(nil)}, InitialDelaySeconds:180, TimeoutSeconds
:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers, spec.template.spec.initContainers[0].readinessProb
e: Invalid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7b90), TCPSocket:(*api.TCPSocketActi
on)(nil)}, InitialDelaySeconds:10, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers].
Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.template.spec.initContainers[0].livenessProbe, m
essage=Invalid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7340), TCPSocket:(*api.TCPSocket
Action)(nil)}, InitialDelaySeconds:180, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containe
rs, reason=FieldValueInvalid, additionalProperties={}), StatusCause(field=spec.template.spec.initContainers[0].readinessProbe, message=Invalid value:
api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7b90), TCPSocket:(*api.TCPSocketAction)(nil)}, Initial
DelaySeconds:10, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers, reason=FieldValueIn
valid, additionalProperties={})], group=null, kind=DeploymentConfig, name=sample-project, retryAfterSeconds=null, uid=null, additionalPr
operties={}), kind=Status, message=DeploymentConfig "sample-project" is invalid: [spec.template.spec.initContainers[0].livenessProbe: In
valid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil),
我认为 initContainer 不应包含 livenessProbe 和 readinessProbe,因为它会在应用程序容器之前结束,不确定为什么 f-m-p 会生成它。我是否缺少某些配置或者这是 fabric8-maven-plugin 的错误?
使用的 fabric8.maven.plugin.version 版本 - 3.5.33.fuse-000067-redhat-1.
注意:从 openshift.yml 中删除 initcontainers 的 livnessProbe 和 readinessProbe 并应用资源 (mvn fabric8:apply
) 成功。
这是 fabric8 插件中的问题。
https://github.com/fabric8io/fabric8-maven-plugin/issues/1283
我在 deployment.yml 中使用 initContainers 并使用 fabric8-maven-plugin 将应用程序部署到 openshift。
initContainers 片段来自 deployment.yml
spec:
template:
spec:
volumes:
- emptyDir: {}
name: work-dir
containers:
- name: hello-world
resources:
requests:
cpu: "0.2"
# memory: 256Mi
limits:
cpu: "1.0"
# memory: 256Mi
volumeMounts:
- mountPath: /var/work-dir
name: work-dir
initContainers:
- args:
- -c
command:
- /bin/bash
image: docker-registry.default.svc:5000/openshift/rhel-openssl-keytool
imagePullPolicy: Always
name: init-hello-world
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/work-dir
name: work-dir
f-m-p生成的openshift.yml将livenessProbe和readinessProbe添加到无效的initContainers中。 生成的 DC:
initContainers:
- args:
- -c
command:
- /bin/bash
image: docker-registry.default.svc:5000/openshift/rhel-openssl-keytool
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 180
name: init-hello-world
readinessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 10
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/work-dir
name: work-dir
部署 (mvn fabric8:deploy
) 失败并显示 "io.fabric8.kubernetes.client.KubernetesClientException spec.template.spec.initContainers[0].livenessProbe: Invalid value:"
[INFO] Updating DeploymentConfig from openshift.yml
[ERROR] Failed to update DeploymentConfig from openshift.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PUT at: https
://openshifthost.com/deploymentconfigs/sample-project. Message: Deployment
Config "sample-project" is invalid: [spec.template.spec.initContainers[0].livenessProbe: Invalid value: api.Probe{Handler:api.Handler{Ex
ec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7340), TCPSocket:(*api.TCPSocketAction)(nil)}, InitialDelaySeconds:180, TimeoutSeconds
:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers, spec.template.spec.initContainers[0].readinessProb
e: Invalid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7b90), TCPSocket:(*api.TCPSocketActi
on)(nil)}, InitialDelaySeconds:10, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers].
Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.template.spec.initContainers[0].livenessProbe, m
essage=Invalid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7340), TCPSocket:(*api.TCPSocket
Action)(nil)}, InitialDelaySeconds:180, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containe
rs, reason=FieldValueInvalid, additionalProperties={}), StatusCause(field=spec.template.spec.initContainers[0].readinessProbe, message=Invalid value:
api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7b90), TCPSocket:(*api.TCPSocketAction)(nil)}, Initial
DelaySeconds:10, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers, reason=FieldValueIn
valid, additionalProperties={})], group=null, kind=DeploymentConfig, name=sample-project, retryAfterSeconds=null, uid=null, additionalPr
operties={}), kind=Status, message=DeploymentConfig "sample-project" is invalid: [spec.template.spec.initContainers[0].livenessProbe: In
valid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil),
我认为 initContainer 不应包含 livenessProbe 和 readinessProbe,因为它会在应用程序容器之前结束,不确定为什么 f-m-p 会生成它。我是否缺少某些配置或者这是 fabric8-maven-plugin 的错误?
使用的 fabric8.maven.plugin.version 版本 - 3.5.33.fuse-000067-redhat-1.
注意:从 openshift.yml 中删除 initcontainers 的 livnessProbe 和 readinessProbe 并应用资源 (mvn fabric8:apply
) 成功。
这是 fabric8 插件中的问题。 https://github.com/fabric8io/fabric8-maven-plugin/issues/1283