Service
Definition
services:
# Full Service Definition
full: # service id
annotations:
service-annotation: "full service definition"
labels:
service-label: "full service definition"
spec: # service spec (spec.ports, spec.selector are ignored)
type: LoadBalancer
ports:
api:
port: 8080 # service port number
targetPort: http # container port name
protocol: TCP # default TCP
monitorEndpoint: # item for spec.endpoints of service monitor
interval: 10s
path: /extra-metrics
metrics:
port: 81 # service port number
targetPort: 80 # reference port by number instead of name
protocol: TCP # default TCP
monitorEndpoint: # item for spec.endpoints of service monitor
interval: 30s
relabelings:
- action: labeldrop
regex: pod
monitor:
annotations:
monitor-annotation: "full service monitor"
labels:
monitor-labels: "full service monitor"
spec:
jobLabel: full-service # job label for collected metrics
apiVersion: v1
kind: Service
metadata:
annotations:
service-annotation: full service definition
labels:
app.kubernetes.io/component: cicd-sample
app.kubernetes.io/instance: docs
app.kubernetes.io/managed-by: helm
app.kubernetes.io/name: cicd-sample
app.kubernetes.io/part-of: cicd
app.kubernetes.io/version: 1.0.0
exordis/application: cicd-sample
exordis/application-instance: docs
exordis/application-type: service
exordis/environment: test
exordis/product: Some Product
exordis/service-name: cicd-sample-docs-full
exordis/subsystem: cicd
helm.sh/chart: cicd-subsystem-application-0.1.0
service-label: full service definition
name: cicd-sample-docs-full
namespace: cicd-test
spec:
ports:
- name: api
port: 8080
protocol: TCP
targetPort: http
- name: metrics
port: 81
protocol: TCP
targetPort: 80
selector:
exordis/application: cicd-sample
exordis/application-instance: docs
exordis/application-workload: "true"
exordis/environment: test
exordis/subsystem: cicd
sessionAffinity: None
type: LoadBalancer
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
annotations:
monitor-annotation: full service monitor
labels:
app.kubernetes.io/component: cicd-sample
app.kubernetes.io/instance: docs
app.kubernetes.io/managed-by: helm
app.kubernetes.io/name: cicd-sample
app.kubernetes.io/part-of: cicd
app.kubernetes.io/version: 1.0.0
exordis/application: cicd-sample
exordis/application-instance: docs
exordis/application-type: service
exordis/environment: test
exordis/product: Some Product
exordis/subsystem: cicd
helm.sh/chart: cicd-subsystem-application-0.1.0
monitor-labels: full service monitor
name: cicd-sample-docs-full
namespace: cicd-test
spec:
endpoints:
- interval: 10s
path: /extra-metrics
port: api
- interval: 30s
port: metrics
relabelings:
- action: labeldrop
regex: pod
jobLabel: full-service
namespaceSelector:
matchNames:
- cicd-test
selector:
matchLabels:
exordis/application: cicd-sample
exordis/application-instance: docs
exordis/environment: test
exordis/service-name: cicd-sample-docs-full
exordis/subsystem: cicd
enabled
-
if set to false service is excluded from rendering
default: true
namespace
-
service namespace
default: subsystem namespace generated with naming conventions
labels
-
list of labels to add to service in addition to common labels
default: empty dict
annotations
-
list of annotations to add to service in addition to common labels
default: empty dict
spec
-
service kubernetes manifests
spec
field value.spec.ports
is ignored and generated based onservice.ports
.spec.selector
is ignored and generated to match application workloaddefault: empty dict
ports
-
service ports dictionary with port name as key.
default: empty dict
Port definition:
port
-
service port number
targetPort
-
target container port name (recommended) or number
protocol
-
protocol
TCP
(default),UDP
orSTCP
monitorEndpoint
-
endpoint definition for service monitor
monitor
-
service monitor
annotations
-
annotations to add to service monitor in addition to common labels.
default: empty dict labels
- labels to add to service monitor in addition to common labels.
default: empty dict namespace
-
service namespace
default: subsystem namespace generated with naming conventions
spec
-
service monitor manifest
spec
field.namespaceSelector
andselector
are ignored and generated to match the serviceendpoints
is ignored and generated from serviceports
(as defined byServiceMonitor
CRD)default:
jobLabel: <service id>
Minimum Viable Service Definition
- Default metadata
- Single port named
http
with default 80 port number - Service is mapped to workload container ports named the same as service port -
http
- No service monitor
applicationContainer:
spec:
ports:
- containerPort: 8080
name: http
services:
minimum:
ports:
http:
Validations
- Port referenced in service is not exposed by
applicationContainer
or any ofsidecars
Overrides
name
-
generated with naming conventions from service
id
spec.selector
-
generated to match application workload
Manifests Generation
Service
Service manifest is generated for each service.
- common labels are added to metadata
Note
If Values.workload
is none
service will be generated with selector matching no pods
Service Monitor
- common labels are added to metadata
- Service monitor is generated if service defines at least one port with
monitorEndpoint
(may be null) - Service monitor
id
is considered to be equal to serviceid
- Service monitor is generated with naming conventions