[promtail helm chart] Enable support for syslog service (#1617)

* Enable support for dynamic extra ports

This should allow the chart to be configured for extra exposed ports
like syslog (port 1514) for example

Signed-off-by: Jeff Billimek <jeff@billimek.com>

* making syslog its own optional service

Signed-off-by: Jeff Billimek <jeff@billimek.com>

* syslogService config should be at top level

Signed-off-by: Jeff Billimek <jeff@billimek.com>

* fixing linting error

Signed-off-by: Jeff Billimek <jeff@billimek.com>

* Enhancing chart documentation with syslog example

Signed-off-by: Jeff Billimek <jeffrey_k_billimek@homedepot.com>
pull/1697/head^2
Jeff Billimek 5 years ago committed by GitHub
parent 460bb5b857
commit 9fe1f13e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      production/helm/README.md
  2. 2
      production/helm/loki-stack/Chart.yaml
  3. 2
      production/helm/promtail/Chart.yaml
  4. 4
      production/helm/promtail/templates/daemonset.yaml
  5. 42
      production/helm/promtail/templates/service-syslog.yaml
  6. 24
      production/helm/promtail/values.yaml

@ -125,6 +125,30 @@ tls:
- {{ .Values.ingress.host }}
```
## Run promtail with syslog support
In order to receive and process syslog message into promtail, the following changes will be necessary:
* Review the [promtail syslog-receiver configuration documentation](/docs/clients/promtail/scraping.md#syslog-receiver)
* Configure the promtail helm chart with the syslog configuration added to the `extraScrapeConfigs` section and associated service definition to listen for syslog messages. For example:
```yaml
extraScrapeConfigs:
- job_name: syslog
syslog:
listen_address: 0.0.0.0:1514
labels:
job: "syslog"
relabel_configs:
- source_labels: ['__syslog_message_hostname']
target_label: 'host'
syslogService:
enabled: true
type: LoadBalancer
port: 1514
```
## How to contribute
After adding your new feature to the appropriate chart, you can build and deploy it locally to test:

@ -1,6 +1,6 @@
apiVersion: "v1"
name: loki-stack
version: 0.31.2
version: 0.32.0
appVersion: v1.3.0
kubeVersion: "^1.10.0-0"
description: "Loki: like Prometheus, but for logs."

@ -1,6 +1,6 @@
apiVersion: "v1"
name: promtail
version: 0.18.1
version: 0.19.0
appVersion: v1.3.0
kubeVersion: "^1.10.0-0"
description: "Responsible for gathering logs and sending them to Loki"

@ -86,6 +86,10 @@ spec:
ports:
- containerPort: {{ .Values.config.server.http_listen_port }}
name: http-metrics
{{- if .Values.syslogService.enabled }}
- containerPort: {{ .Values.syslogService.port }}
name: syslog
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- if .Values.livenessProbe }}

@ -0,0 +1,42 @@
{{- if .Values.syslogService.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "promtail.fullname" . }}-syslog
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "promtail.name" . }}
chart: {{ template "promtail.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.syslogService.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- toYaml .Values.syslogService.annotations | nindent 4 }}
spec:
type: {{ .Values.syslogService.type }}
{{- if (and (eq .Values.syslogService.type "ClusterIP") (not (empty .Values.syslogService.clusterIP))) }}
clusterIP: {{ .Values.syslogService.clusterIP }}
{{- end }}
{{- if .Values.syslogService.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range $cidr := .Values.syslogService.loadBalancerSourceRanges }}
- {{ $cidr }}
{{- end }}
{{- end }}
ports:
- port: {{ .Values.syslogService.port }}
protocol: TCP
name: syslog
targetPort: syslog
{{- if (and (eq .Values.syslogService.type "NodePort") (not (empty .Values.syslogService.nodePort))) }}
nodePort: {{ .Values.syslogService.nodePort }}
{{- end }}
{{- if .Values.extraPorts }}
{{ toYaml .Values.extraPorts | indent 4}}
{{- end }}
selector:
app: {{ template "promtail.name" . }}
release: {{ .Release.Name }}
{{- end }}

@ -127,6 +127,7 @@ config:
server:
http_listen_port: 3101
positions:
filename: /run/promtail/positions.yaml
target_config:
@ -141,3 +142,26 @@ serviceMonitor:
# Extra env variables to pass to the promtail container
env: []
# enable and configure if using the syslog scrape config
syslogService:
enabled: false
type: ClusterIP
port: 1514
## Specify the nodePort value for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
##
# nodePort:
## Provide any additional annotations which may be required. This can be used to
## set the LoadBalancer service type to internal only.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
##
annotations: {}
labels: {}
## Use loadBalancerIP to request a specific static IP,
## otherwise leave blank
##
loadBalancerIP:
# loadBalancerSourceRanges: []
## Set the externalTrafficPolicy in the Service to either Cluster or Local
# externalTrafficPolicy: Cluster

Loading…
Cancel
Save