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
18 changes: 18 additions & 0 deletions charts/fluentd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,24 @@ The `fileConfigs` section is organized by sources -> filters -> destinations. Fl
</label>
```

## Headless Service

The chart supports deploying a headless service, which is useful for StatefulSet deployments where you need direct pod DNS resolution (e.g., `pod-0.fluentd-headless.namespace.svc.cluster.local`).

To enable the headless service, configure the following values:

```yaml
headlessService:
enabled: true
annotations: {}
ports:
- name: "forwarder"
protocol: TCP
containerPort: 24224
```

The headless service will be created with the name `<release-name>-fluentd-headless` and will expose the metrics port (24231) by default, plus any additional ports specified in `headlessService.ports`.

## Backwards Compatibility - v0.1.x

The old fluentd chart used the ENV variables and the default fluentd container definitions to set-up automatically many aspects of fluentd. It is still possible to trigger this behaviour by removing this charts current `.Values.env` configuration and replace by:
Expand Down
30 changes: 30 additions & 0 deletions charts/fluentd/templates/headless-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if .Values.headlessService.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "fluentd.fullname" . }}-headless
labels:
{{- include "fluentd.labels" . | nindent 4 }}
{{- with .Values.headlessService.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: ClusterIP
clusterIP: None
ports:
- port: 24231
targetPort: metrics
protocol: TCP
name: metrics
{{- if .Values.headlessService.ports }}
{{- range $port := .Values.headlessService.ports }}
- name: {{ $port.name }}
port: {{ $port.containerPort }}
targetPort: {{ $port.containerPort }}
protocol: {{ $port.protocol }}
{{- end }}
{{- end }}
selector:
{{- include "fluentd.selectorLabels" . | nindent 4 }}
{{- end -}}
6 changes: 3 additions & 3 deletions charts/fluentd/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and ( eq .Values.kind "Deployment" ) .Values.autoscaling.enabled }}
{{- if .Values.autoscaling.enabled }}
apiVersion: {{ include "fluentd.hpa.apiVersion" . }}
kind: HorizontalPodAutoscaler
metadata:
Expand All @@ -12,7 +12,7 @@ spec:
{{- end }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
kind: {{ .Values.kind }}
name: {{ include "fluentd.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
Expand All @@ -36,4 +36,4 @@ spec:
{{- if .Values.autoscaling.customRules -}}
{{- toYaml .Values.autoscaling.customRules | nindent 4}}
{{- end -}}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/fluentd/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "fluentd.fullname" . }}
labels:
{{- include "fluentd.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "fluentd.selectorLabels" . | nindent 6 }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/fluentd/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
serviceName: {{ include "fluentd.fullname" . }}
{{- with .Values.updateStrategy }}
updateStrategy:
Expand All @@ -25,6 +27,10 @@ spec:
{{- with .Values.minReadySeconds }}
minReadySeconds: {{ . }}
{{- end }}
{{- with .Values.persistentVolumeClaimRetentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
template:
metadata:
annotations:
Expand Down
19 changes: 19 additions & 0 deletions charts/fluentd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ updateStrategy: {}
# rollingUpdate:
# maxUnavailable: 1

persistentVolumeClaimRetentionPolicy: {}
# whenDeleted: Delete
# whenScaled: Delete

podDisruptionBudget:
enabled: false
# minAvailable: 1
# maxUnavailable: 1

## Additional environment variables to set for fluentd pods
env: []
# - name: "FLUENTD_CONF"
Expand Down Expand Up @@ -210,6 +219,16 @@ service:
# protocol: TCP
# containerPort: 24224

## Headless service for StatefulSet
##
headlessService:
enabled: false
annotations: {}
ports: []
# - name: "forwarder"
# protocol: TCP
# containerPort: 24224

## Prometheus Monitoring
##
metrics:
Expand Down
Loading