Skip to content

[Enhancement]: Service definitions use named ports rather than port numbers #11393

Open
@jcpunk

Description

@jcpunk

Related problem

Current Kubernetes best practices suggest use of named ports for connecting services to containers rather than port numbers. Currently the created services use explicit port numbers when connecting to the generated containers.

Suggested solution

Use the assigned port names in the created service definitions.

Alternatives

It currently works.

Additional context

from the container:

      name: kafka
      ports:
      - containerPort: 9090
        name: tcp-ctrlplane
        protocol: TCP
      - containerPort: 9091
        name: tcp-replication
        protocol: TCP
      - containerPort: 9092
        name: tcp-clients
        protocol: TCP
      - containerPort: 9093
        name: tcp-clientstls
        protocol: TCP
      - containerPort: 9094
        name: tcp-external
        protocol: TCP
      - containerPort: 9404
        name: tcp-prometheus

from a service:

    ports:
    - name: tcp-ctrlplane
      port: 9090
      protocol: TCP
      targetPort: 9090   ### change this
    - name: tcp-replication
      port: 9091
      protocol: TCP
      targetPort: 9091   ### change this
    - name: tcp-kafkaagent
      port: 8443
      protocol: TCP
      targetPort: 8443   ### change this
    - name: tcp-clients
      port: 9092
      protocol: TCP
      targetPort: 9092   ### change this
    - name: tcp-clientstls
      port: 9093
      protocol: TCP
      targetPort: 9093   ### change this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions