Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 77 additions & 2 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This chart deploys an Apache Fluss cluster on Kubernetes, following Helm best pr
It requires a Zookeeper ensemble to be running in the same Kubernetes cluster. In future releases, we may add support for an embedded Zookeeper cluster.


## Development environment
## Development environment

| component | version |
| ------------------------------------------------------------------------------ | ------- |
Expand All @@ -33,7 +33,7 @@ It requires a Zookeeper ensemble to be running in the same Kubernetes cluster. I
| [Apache Fluss](https://fluss.apache.org/docs/) | v0.10.0-incubating |


## Image requirements
## Image requirements

A container image for Fluss is available on DockerHub as `fluss/fluss`. You can use it directly or build your own from this repo. To use your own image you need to build the project with [Maven](https://fluss.apache.org/community/dev/building/) and build it with Docker.

Expand Down Expand Up @@ -93,6 +93,81 @@ Important Fluss options surfaced by the chart:
- internal.listener.name: Which listener is used for internal communication (defaults to INTERNAL).
- tablet-server.id: Required to be unique per TabletServer. The chart auto‑derives this from the StatefulSet pod ordinal at runtime.

### Metrics and Prometheus Scraping

The chart can enable Fluss metrics reporters and create dedicated metrics services for `coordinator` and `tablet` components.

Example:

```bash
helm install fluss ./fluss-helm \
--set metrics.enabled=true
```

When enabled, the chart will:

- configure `metrics.reporters` from reporter names in values
- configure `metrics.reporter.<name>.<option>` entries from values

Values:

| Key | Description |
| --- | --- |
| `metrics.enabled` | Enables metrics reporting and endpoint exposure. |
| `metrics.reporters` | Map of Fluss metric reporters and their options. |
| `metrics.reporters.jmx.port` | JMX reporter port range (e.g. `9250-9260`). |
| `metrics.reporters.prometheus.port` | Prometheus reporter port (default `9249`). |
| `metrics.reporters.prometheus.service.portName` | Named port exposed by metrics services (default `metrics`). |
| `metrics.reporters.prometheus.service.labels` | Optional labels on metrics services (useful for [ServiceMonitor](https://prometheus-operator.dev/docs/api-reference/api/#monitoring.coreos.com/v1.ServiceMonitor) selectors). |
| `metrics.reporters.prometheus.service.annotations` | Optional annotations on metrics services (useful for annotation-based scraping). |

#### Prometheus Annotation Based Scraping

The values below enable annotation based scraping:

```yaml
metrics:
enabled: true
reporters:
prometheus:
port: 9249
service:
annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "9249"
```

#### Prometheus ServiceMonitor Based Scraping

When using the [Prometheus Operator](https://prometheus-operator.dev/), use the values below to add labels to the metrics services and then create a `ServiceMonitor` that selects them:

```yaml
metrics:
enabled: true
reporters:
prometheus:
port: 9249
service:
portName: metrics
labels:
monitoring: enabled
```

Apply the following to create a `ServiceMonitor` resource that matches the label:

```yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: fluss-metrics
spec:
selector:
matchLabels:
monitoring: enabled
endpoints:
- port: metrics
```

### Zookeeper and storage
- zookeeper.address must point to a reachable ensemble.
Expand Down
58 changes: 58 additions & 0 deletions helm/templates/_metrics.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

{{/*
Renders metrics reporter configuration entries.
Expects the root context as argument.

From values:
metrics:
reporters:
prometheus:
port: 9249

Renders:
metrics.reporters: prometheus
metrics.reporter.prometheus.port: 9249

Keys already present in configurationOverrides are not rendered.
*/}}
{{- define "fluss.metrics.config" -}}
{{- if .Values.metrics.enabled -}}
{{- $config := .Values.configurationOverrides | default dict -}}
{{- $reporters := .Values.metrics.reporters | default dict -}}
{{- $reporterNames := keys $reporters | sortAlpha -}}
{{- if eq (len $reporterNames) 0 -}}
{{- fail "metrics.reporters must contain at least one reporter when metrics.enabled is true" -}}
{{- end -}}
{{- if not (hasKey $config "metrics.reporters") }}
metrics.reporters: {{ join "," $reporterNames }}
{{- end -}}
{{- range $name := $reporterNames -}}
{{- range $option, $value := index $reporters $name -}}
{{- if ne $option "service" -}}
{{- $fullKey := printf "metrics.reporter.%s.%s" $name $option -}}
{{- if not (hasKey $config $fullKey) }}
{{ $fullKey }}: {{ tpl (printf "%v" $value) $ }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

3 changes: 2 additions & 1 deletion helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ data:
server.yaml: |
{{- range $key, $val := .Values.configurationOverrides }}
{{ $key }}: {{ tpl (printf "%v" $val) $ }}
{{- end }}
{{- end }}
{{- include "fluss.metrics.config" . | nindent 4 }}
46 changes: 46 additions & 0 deletions helm/templates/svc-metrics-coordinator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

{{- if and .Values.metrics.enabled .Values.metrics.reporters.prometheus }}
{{- $promSvc := .Values.metrics.reporters.prometheus.service | default dict }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-coordinator-server-metrics-hs
labels:
{{- include "fluss.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics
{{- with $promSvc.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $promSvc.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
clusterIP: None
type: ClusterIP
ports:
- name: {{ default "metrics" $promSvc.portName }}
protocol: TCP
port: {{ default 9249 .Values.metrics.reporters.prometheus.port }}
targetPort: {{ default 9249 .Values.metrics.reporters.prometheus.port }}
selector:
{{- include "fluss.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: coordinator
{{- end }}
46 changes: 46 additions & 0 deletions helm/templates/svc-metrics-tablet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

{{- if and .Values.metrics.enabled .Values.metrics.reporters.prometheus }}
{{- $promSvc := .Values.metrics.reporters.prometheus.service | default dict }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-tablet-server-metrics-hs
labels:
{{- include "fluss.labels" . | nindent 4 }}
app.kubernetes.io/component: metrics
{{- with $promSvc.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $promSvc.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
clusterIP: None
type: ClusterIP
ports:
- name: {{ default "metrics" $promSvc.portName }}
protocol: TCP
port: {{ default 9249 .Values.metrics.reporters.prometheus.port }}
targetPort: {{ default 9249 .Values.metrics.reporters.prometheus.port }}
selector:
{{- include "fluss.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: tablet
{{- end }}
Loading