Skip to main content

Service (Internal Traffic)

Artifact Hub

In short, there are three things you need to know:

  1. Containers in the same component will be started within a Kubernetes pod which allows these containers to communicate via localhost.
  2. If you want containers to communicate across components (cluster-internal traffic), you need to define services for these components.
  3. If you want to connect a domain to a service (external internet traffic), you need to configure an ingress for this service.

To allow other containers to access this component within the cluster-internal network (2.), you can configure the service section for the component:

containers:
- name: podinfo
image: stefanprodan/podinfo
service:
ports:
- port: 9898

Now, the component is accessible via:

[HELM_RELEASE_NAME]:9898  # podinfo:9898

ports​

The ports option is mandatory and expects an array of port definitions.

port​

The port option is mandatory and expect an integer with a port number. The service will be available on this port.

containerPort​

The containerPort option is optional and tells the service to forward the traffic from the service port (defined in port) to a different containerPort of a pod.

Default for containerPort​

containerPort: [same as `port` option]

name​

The name option is optional and allows you to customize the name of the port.

Default for name​

By default the port name will be "port-0", "port-1" etc.

name: port-0

nodePort​

The nodePort option is optional and tells the service to expose the service at a static node port. Applicable to NodePort service type.

protocol​

The protocol option is optional and expects a string that defines the network protocol for this service port.

Default for protocol​

protocol: TCP

type​

The type option is optional and expects a string that defines the type of the service.

Default for type​

type: ClusterIP

externalIPs​

The externalIPs option is optional and expects an array of IP addresses for the service.

clusterIP​

The clusterIP option is optional and expects a string that defines the cluster-internal IP address for the service.

externalName​

The externalName option is optional and expects a string for ExternalName services.

externalTrafficPolicy​

The externalTrafficPolicy option is optional and expects a string that defines how external traffic is routed for NodePort and LoadBalancer services.

healthCheckNodePort​

The healthCheckNodePort option is optional and expects an integer for the health check node port of a LoadBalancer service.

ipFamily​

The ipFamily option is optional and expects a string that defines the service IP family.

loadBalancerIP​

The loadBalancerIP option is optional and expects a string with the load balancer IP address.

loadBalancerSourceRanges​

The loadBalancerSourceRanges option is optional and expects an array of CIDR ranges allowed to access a LoadBalancer service.

publishNotReadyAddresses​

The publishNotReadyAddresses option is optional and expects a boolean.

sessionAffinity​

The sessionAffinity option is optional and expects a string.

sessionAffinityConfig​

The sessionAffinityConfig option is optional and expects an object with Kubernetes service session affinity configuration.

topologyKeys​

The topologyKeys option is optional and expects an array of topology keys.

name​

The name option is optional and expects a string that defines the name of the service.

note

This is different from the top-level serviceName option, which sets the headless service name for StatefulSets. service.name controls the name of the Service resource created by this chart.

Default for name​

name: [HELM_RELEASE_NAME]

labels​

The labels option is optional and expects a map of additional Kubernetes labels for the service.

annotations​

The annotations option is optional and expects a map of additional Kubernetes annotations for the service.