Services
services renders one Service per key. By default a service selects the pods of the deployments entry with the same key, so a matching deployment is all it needs to route traffic:
deployments:
api:
containers:
api:
ports:
http:
containerPort: 8080
services:
api:
ports:
http:
port: 80
targetPort: httpFor a release named test, that renders Service/test-api. The service: shorthand injects into the map under the release name for a single-service chart:
service:
ports:
http:
port: 80
targetPort: httpPorts
ports is a map keyed by port name. Each entry is a standard Kubernetes service port. targetPort defaults to the first port declared on the selected deployment, so you can usually omit it:
services:
api:
ports:
http:
port: 80 # targetPort defaults to the deployment's first port
metrics:
port: 9090
targetPort: metricsType
Services default to ClusterIP. Set type for anything else:
services:
api:
type: LoadBalancer
ports:
http:
port: 80Selector
The selector is built from the release's selector labels plus the deployment key, so a service in a multi-deployment release targets exactly one deployment. The chart matches the deployment whose key equals the service key; when none matches, it falls back to the first enabled deployment alphabetically. Give the service the same key as its deployment to keep the wiring obvious.
Ingresses
An ingress resolves its backend by matching the service key, so an ingresses.web routes to services.web with no extra configuration. See Ingresses.
Disabling a service
Set enabled: false to keep a service in values but skip rendering it:
services:
debug:
enabled: false
ports:
http:
port: 80