Chart version: 7.8.1
Kubernetes version: 1.18
Helm Version: 3.3.0-rc.2
Logstash headless service uses container ports from .Values.extraPorts which are incompatible with the service spec.
Hello,
it seems there is httpPort: https://github.com/elastic/helm-charts/blob/master/logstash/templates/service-headless.yaml#L20
What is the problem exactly? service supports multi-ports.
.Values.extraPorts is a container port spec used in statefulset:
https://github.com/elastic/helm-charts/blob/c5660f410ca108c05ce884d257639d77d55fb89a/logstash/templates/statefulset.yaml#L151-L156
Service has a different spec for ports, so chart installation fails when .Values.extraPorts is specified due to invalid service spec.
Yes, i got the same issue. "extraPorts" defined in values.yaml are used on both service-headless and statefulset directly but they require different definition. E.g. containerPort cannot exist in Service definition and containerPort is mandatory in Statefulset definition. This issue is introduced by #695
+1
The non-headless service uses .Values.service.ports, which is what the headless service also needs to use.
This issue prevents the Logstash Helm chart from being used when extra ports need to be opened (e.g. for a Beats input). I don't think there is a workaround either.
I just submitted a PR (#776) to address it as suggested by @autarchprinceps. Can this please be reviewed, merged and released ASAP so that the chart becomes usable again?
+1
To be more explicit :
With
extraPorts:
- name: beats
containerPort: 5044
I have an error : error validating data: [ValidationError(Service.spec.ports[1]): unknown field "containerPort" in io.k8s.api.core.v1.ServicePort, ValidationError(Service.spec.ports[1]): missing required field "port" in io.k8s.api.core.v1.ServicePort]
extraPorts:
- name: beats
port: 5044
I have an error : error validating data: [ValidationError(StatefulSet.spec.template.spec.containers[0].ports[1]): unknown field "port" in io.k8s.api.core.v1.ContainerPort, ValidationError(StatefulSet.spec.template.spec.containers[0].ports[1]): missing required field "containerPort" in io.k8s.api.core.v1.ContainerPort]
As @kopwei said, ServicePort and ContainerPort definition are not the same (https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#serviceport-v1-core and https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerport-v1-core), so you cannot use the same value for both.
Note that the error is only located on the headless-service.yaml, the service.yaml is working well.
As headless-service cannot be skipped in the chart, there is no workaround.
I'm having the same problem :/
The extraPorts is used in a service definition and on a pod container definition. That doesn't work because these are two different APIs.
Same for me:
Chart version: 7.9.0
Kubernetes version: 1.18
Helm Version: 3.2.0
It works when downgrading 2 versions. I'm using 6.8.10 instead of 6.8.12 with Helm 3. I wanted to configure an extra UDP port. This is a working config:
extraPorts:
- name: logs # UDP port to send GraphQL logs to
containerPort: 11111
service:
ports:
- name: logs
port: 11111
protocol: UDP
targetPort: 11111
Most helpful comment
The non-headless service uses
.Values.service.ports, which is what the headless service also needs to use.