-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Related problem
In our deployment we need to expose additional container ports on the main Kafka container (for example, for custom monitoring endpoints and health checks on a slightly modified Kafka distribution).
With the current Strimzi configuration options, it does not seem possible to configure extra containerPorts on the Kafka container managed by the operator. The template.kafkaContainer section lets us customize some aspects of the container (env, etc.), but there is no way to add or override the ports list.
As a result, we cannot declare these extra ports in the Kafka CR, which makes it harder to integrate with Kubernetes-level tooling that relies on container ports (probes, NetworkPolicy, Service mesh sidecars, etc.).
Suggested solution
It would be very helpful if both Kafka.spec.kafka.template.kafkaContainer and KafkaNodePool.spec.template.kafkaContainer allowed configuring the container ports in a declarative way.
For example, something along the lines of:
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
spec:
kafka:
template:
kafkaContainer:
ports:
- name: custom-metrics
containerPort: 8890
- name: custom-health
containerPort: 8891
---
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaNodePool
spec:
# ...
template:
kafkaContainer:
ports:
- name: custom-metrics
containerPort: 8890
- name: custom-health
containerPort: 8891In both cases, template.kafkaContainer.ports would be treated as additional ports merged with the defaults, so that users only need to declare the extra ports they require.
Alternatives
None.
Additional context
- Our Kafka image has some minor customizations (e.g. extra monitoring/health endpoints) that rely on these additional ports being declared in the container spec.
- If you have a recommended pattern for this use case with the existing API and we have missed it, we would also appreciate any pointers to the documentation or examples.