From b31fc320b5cc1697398df21e5d7a54d7c159c394 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Wed, 30 Nov 2016 16:59:58 -0800 Subject: [PATCH 01/12] Add telegraf plugin --- stable/telegraf/.helmignore | 21 + stable/telegraf/Chart.yaml | 13 + stable/telegraf/README.md | 205 ++++++++ stable/telegraf/templates/_helpers.tpl | 164 +++++++ stable/telegraf/templates/configmap-s.yaml | 17 + stable/telegraf/templates/conifgmap-ds.yaml | 17 + stable/telegraf/templates/daemonset.yaml | 62 +++ stable/telegraf/templates/deployment.yaml | 30 ++ stable/telegraf/templates/service.yaml | 42 ++ stable/telegraf/values.yaml | 491 ++++++++++++++++++++ 10 files changed, 1062 insertions(+) create mode 100644 stable/telegraf/.helmignore create mode 100755 stable/telegraf/Chart.yaml create mode 100644 stable/telegraf/README.md create mode 100644 stable/telegraf/templates/_helpers.tpl create mode 100644 stable/telegraf/templates/configmap-s.yaml create mode 100644 stable/telegraf/templates/conifgmap-ds.yaml create mode 100644 stable/telegraf/templates/daemonset.yaml create mode 100644 stable/telegraf/templates/deployment.yaml create mode 100644 stable/telegraf/templates/service.yaml create mode 100644 stable/telegraf/values.yaml diff --git a/stable/telegraf/.helmignore b/stable/telegraf/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/telegraf/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/stable/telegraf/Chart.yaml b/stable/telegraf/Chart.yaml new file mode 100755 index 0000000000..076710cffb --- /dev/null +++ b/stable/telegraf/Chart.yaml @@ -0,0 +1,13 @@ +name: telegraf +version: 0.1.0 +description: Chart for Telegraf Kubernetes deployments +keywords: +- telegraf +- collector +- timeseries +- influxdata +home: https://www.influxdata.com/time-series-platform/telegraf/ +maintainers: +- name: Jack Zampolin + email: jack@influxdb.com +engine: gotpl \ No newline at end of file diff --git a/stable/telegraf/README.md b/stable/telegraf/README.md new file mode 100644 index 0000000000..543f839c5c --- /dev/null +++ b/stable/telegraf/README.md @@ -0,0 +1,205 @@ +# Telegraf + +[Telegraf](https://github.com/influxdata/telegraf) is a plugin-driven server agent written by the folks over at [InfluxData](https://influxdata.com) for collecting & reporting metrics. + +## TL;DR + +```console +$ helm install stable/telegraf +``` + +## Introduction + +This chart bootstraps a `telegraf` deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.4+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +$ helm install --name my-release stable/telegraf +``` + +The command deploys Telegraf on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the Telegraf chart and their default values. + +```yaml +## Image +image.repo: "telegraf" +image.tag: "1.1.0-alpine" +image.pullPolicy: IfNotPresent +## Daemonset - configuration for telegraf instances running as daemonset +daemonset.enabled: true +# resource requests and limits for the daemonset +daemonset.resources.requests.memory: 256Mi +daemonset.resources.requests.cpu: 0.1 +daemonset.resources.limits.memory: 2Gi +daemonset.resources.limits.cpu: 1 +## Exposed telegraf configuration +## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ +daemonset.config: # See Telegraf Configuration +## Single - configuration for telegraf instances running as deployment +single.enabled: true +# resource requests and limits for the single instance +single.resources.requests.memory: 256Mi +single.resources.requests.cpu: 0.1 +single.resources.limits.memory: 2Gi +single.resources.limits.cpu: 1 +single.service.enabled: true +single.service.type: NodePort +## Exposed telegraf configuration +## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ +single.config: # see Telegraf Configuration +``` + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set single.enabled=false \ + stable/telegraf +``` + +The above command prevents the single telegraf instance from deploying. + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml stable/telegraf +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Telegraf Configuration + +This chart deploys the following by default: + +- `telegraf` (`telegraf-ds`) running in a daemonset with the following plugins enabled + * [`cpu`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`disk`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`docker`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/docker) + * [`diskio`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`kernel`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`kubernetes`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/kubernetes) + * [`mem`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`processes`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`swap`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + * [`system`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system) + +- A single `telegraf` deployment (`telegraf-s`) with an associated service running the following plugins: + * [`prometheus`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/prometheus) + * [`influxdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb) + * [`statsd`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) + + +### Supported Outputs + +The following telegraf output plugins are supported for both the daemonset and the single instance. To enable them uncomment them in `.Values.{{ "daemonset" | "single" }}.outputs`: + +- [`amqp`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/amqp) +- [`influxdb`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb) +- [`kafka`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/kafka) +- [`mqtt`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/mqtt) +- [`nats`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/nats) +- [`nsq`](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/nsq) + +### Service Plugins - Single Instance + +The single telegraf also supports all service plugins. To enable them uncomment the named plugin in `.Values.single.inputs` section. The associated service exposes the ports if it is enabled: + +- [`tcp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/tcp_listener) +- [`udp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/udp_listener) +- [`statsd`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) +- [`http_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener) + +### Supported Inputs - Single Instance + +To enable additional input plugins uncomment them in the `.Values.single.inputs` section. The input plugins supported by the single telegraf instance are as follows: + +- [`aerospike`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/aerospike) +- [`apache`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/apache) +- [`cassandra`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cassandra) +- [`cloudwatch`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cloudwatch) +- [`consul`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/consul) +- [`couchbase`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/couchbase) +- [`couchdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/couchdb) +- [`disque`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/disque) +- [`dns_query`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/dns_query) +- [`dovecot`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/dovecot) +- [`elasticsearch`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/elasticsearch) +- [`graylog`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/graylog) +- [`haproxy`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/haproxy) +- [`influxdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb) +- [`lustre2`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/lustre2) +- [`mailchimp`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mailchimp) +- [`memcached`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/memcached) +- [`mesos`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mesos) +- [`mongodb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mongodb) +- [`mysql`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mysql) +- [`net_response`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/net_response) +- [`nginx`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nginx) +- [`nsq`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nsq) +- [`phpfpm`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/phpfpm) +- [`ping`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ping) +- [`postgresql`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/postgresql) +- [`prometheus`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/prometheus) +- [`rabbitmq`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rabbitmq) +- [`raindrops`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/raindrops) +- [`redis`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/redis) +- [`rethinkdb`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/rethinkdb) +- [`riak`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/riak) +- [`sqlserver`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sqlserver) +- [`twemproxy`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/twemproxy) +- [`zookeeper`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/zookeeper) +- [`http_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/http_listener) +- [`statsd`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) +- [`tcp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/tcp_listener) +- [`udp_listener`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/udp_listener) +- [`webhooks`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/webhooks) + +### Future work: + +There are a couple of additional plugins that could/should possibly be supported but are not yet: +- `telegraf-s` + - [`smnp`](https://github.com/influxdata/telegraf/tree/master/plugins/smnp) +- `telegraf-ds` + - [`jolokia`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/jolokia) + - [`bcache`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/bcache) + - [`cgroup`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/cgroup) + - [`conntrack`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/conntrack) + - [`exec`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/exec) + - [`filestat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/filestat) + - [`hddtemp`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/hddtemp) + - [`ipmi_sensor`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ipmi_sensor) + - [`iptables`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/iptables) + - [`leofs`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/leofs) + - [`logparser`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/logparser) + - [`nstat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/nstat) + - [`ntpq`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/ntpq) + - [`passenger`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/passenger) + - [`powerdns`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/powerdns) + - [`procstat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/procstat) + - [`puppetagent`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/puppetagent) + - [`sysstat`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/sysstat) + - [`varnish`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/varnish) + - [`win_perf_counters`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/win_perf_counters) + - [`zfs`](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/zfs) diff --git a/stable/telegraf/templates/_helpers.tpl b/stable/telegraf/templates/_helpers.tpl new file mode 100644 index 0000000000..46f2741621 --- /dev/null +++ b/stable/telegraf/templates/_helpers.tpl @@ -0,0 +1,164 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- end -}} + +{{/* + CUSTOM TEMPLATES: This section contains templates that make up the different parts of the telegraf configuration file. + - global_tags section + - agent section +*/}} + +{{- define "global_tags" -}} +{{- if . -}} +[global_tags] + {{- range $key, $val := . }} + {{ $key }} = {{ $val | quote }} + {{- end }} +{{- end }} +{{- end -}} + +{{- define "agent" -}} +[agent] +{{- range $key, $value := . -}} + {{- $tp := typeOf $value }} + {{- if eq $tp "string"}} + {{ $key }} = {{ $value | quote }} + {{- end }} + {{- if eq $tp "float64"}} + {{ $key }} = {{ $value | int64 }} + {{- end }} + {{- if eq $tp "int"}} + {{ $key }} = {{ $value | int64 }} + {{- end }} + {{- if eq $tp "bool"}} + {{ $key }} = {{ $value }} + {{- end }} +{{- end }} +{{- end -}} + +{{- define "outputs" -}} +{{- range $output, $config := . }} + [[outputs.{{ $output }}]] + {{- if $config }} + {{- range $key, $value := $config -}} + {{- $tp := typeOf $value }} + {{- if eq $tp "string"}} + {{ $key }} = {{ $value | quote }} + {{- end }} + {{- if eq $tp "float64"}} + {{ $key }} = {{ $value | int64 }} + {{- end }} + {{- if eq $tp "int"}} + {{ $key }} = {{ $value | int64 }} + {{- end }} + {{- if eq $tp "bool"}} + {{ $key }} = {{ $value }} + {{- end }} + {{- if eq $tp "[]interface {}" }} + {{ $key }} = [ + {{- $numOut := len $value }} + {{- $numOut := sub $numOut 1 }} + {{- range $b, $val := $value }} + {{- $i := int64 $b }} + {{- if eq $i $numOut }} + {{ $val | quote }} + {{- else }} + {{ $val | quote }}, + {{- end }} + {{- end }} + ] + {{- end }} + {{- end }} + {{- end }} +{{- end }} +{{- end -}} + +{{- define "inputs" -}} +{{- range $input, $config := . -}} + [[inputs.{{- $input }}]] + {{- if $config -}} + {{- range $key, $value := $config -}} + {{- $tp := typeOf $value -}} + {{- if eq $tp "string" }} + {{ $key }} = {{ $value | quote }} + {{- end }} + {{- if eq $tp "float64" }} + {{ $key }} = {{ $value | int64 }} + {{- end }} + {{- if eq $tp "int" }} + {{ $key }} = {{ $value | int64 }} + {{- end }} + {{- if eq $tp "bool" }} + {{ $key }} = {{ $value }} + {{- end }} + {{- if eq $tp "[]interface {}" }} + {{ $key }} = [ + {{- $numOut := len $value }} + {{- $numOut := sub $numOut 1 }} + {{- range $b, $val := $value }} + {{- $i := int64 $b }} + {{- $tp := typeOf $val }} + {{- if eq $i $numOut }} + {{- if eq $tp "string" }} + {{ $val | quote }} + {{- end }} + {{- if eq $tp "float64" }} + {{ $val | int64 }} + {{- end }} + {{- else }} + {{- if eq $tp "string" }} + {{ $val | quote }}, + {{- end}} + {{- if eq $tp "float64" }} + {{ $val | int64 }}, + {{- end }} + {{- end }} + {{- end }} + ] + {{- end }} + {{- if eq $tp "map[string]interface {}" }} + [[inputs.{{ $input }}.{{ $key }}]] + {{- range $k, $v := $value }} + {{- $tps := typeOf $v }} + {{- if eq $tps "string" }} + {{ $k }} = {{ $v }} + {{- end }} + {{- if eq $tps "[]interface {}"}} + {{ $k }} = [ + {{- $numOut := len $value }} + {{- $numOut := sub $numOut 1 }} + {{- range $b, $val := $v }} + {{- $i := int64 $b }} + {{- if eq $i $numOut }} + {{ $val | quote }} + {{- else }} + {{ $val | quote }}, + {{- end }} + {{- end }} + ] + {{- end }} + {{- if eq $tps "map[string]interface {}"}} + [[inputs.{{ $input }}.{{ $key }}.{{ $k }}]] + {{- range $foo, $bar := $v }} + {{ $foo }} = {{ $bar | quote }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{ end }} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/configmap-s.yaml b/stable/telegraf/templates/configmap-s.yaml new file mode 100644 index 0000000000..fb203c9398 --- /dev/null +++ b/stable/telegraf/templates/configmap-s.yaml @@ -0,0 +1,17 @@ +{{- if .Values.single.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-s + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + telegraf.conf: |+ + {{ template "global_tags" .Values.single.config.global_tags }} + {{ template "agent" .Values.single.config.agent }} + {{ template "outputs" .Values.single.config.outputs }} + {{ template "inputs" .Values.single.config.inputs -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/conifgmap-ds.yaml b/stable/telegraf/templates/conifgmap-ds.yaml new file mode 100644 index 0000000000..ebc7fa45de --- /dev/null +++ b/stable/telegraf/templates/conifgmap-ds.yaml @@ -0,0 +1,17 @@ +{{- if .Values.daemonset.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "fullname" . }}-ds + labels: + app: {{ template "fullname" . }}-ds + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + telegraf.conf: |+ + {{ template "global_tags" .Values.daemonset.config.global_tags }} + {{ template "agent" .Values.daemonset.config.agent }} + {{ template "outputs" .Values.daemonset.config.outputs }} + {{ template "inputs" .Values.daemonset.config.inputs -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/daemonset.yaml b/stable/telegraf/templates/daemonset.yaml new file mode 100644 index 0000000000..8cc7e6c4b7 --- /dev/null +++ b/stable/telegraf/templates/daemonset.yaml @@ -0,0 +1,62 @@ +{{- if .Values.daemonset.enabled -}} +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: {{ template "fullname" . }}-ds + labels: + app: {{ template "fullname" . }}-ds + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" +spec: + template: + metadata: + labels: + app: {{ template "fullname" . }}-ds + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }} + resources: +{{ toYaml .Values.daemonset.resources | indent 10 }} + env: + - name: NODE_IP + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: "HOST_PROC" + value: "/rootfs/proc" + - name: "HOST_SYS" + value: "/rootfs/sys" + volumeMounts: + - name: sysro + mountPath: /rootfs/sys + readOnly: true + - name: procro + mountPath: /rootfs/proc + readOnly: true + - name: docker-socket + mountPath: /var/run/docker.sock + # readOnly: true + - name: varrunutmpro + mountPath: /var/run/utmp + readOnly: true + - name: config + mountPath: /etc/telegraf + volumes: + - name: sysro + hostPath: + path: /sys + - name: docker-socket + hostPath: + path: /var/run/docker.sock + - name: procro + hostPath: + path: /proc + - name: varrunutmpro + hostPath: + path: /var/run/utmp + - name: config + configMap: + name: {{ template "fullname" . }}-ds +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/deployment.yaml b/stable/telegraf/templates/deployment.yaml new file mode 100644 index 0000000000..ed8ca758a0 --- /dev/null +++ b/stable/telegraf/templates/deployment.yaml @@ -0,0 +1,30 @@ +{{- if .Values.single.enabled -}} +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }}-s + labels: + app: {{ template "fullname" . }}-s + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "fullname" . }}-s + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ default "" .Values.image.pullPolicy | quote }} + resources: +{{ toYaml .Values.single.resources | indent 10 }} + volumeMounts: + - name: config + mountPath: /etc/telegraf + volumes: + - name: config + configMap: + name: {{ template "fullname" . }}-s +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/service.yaml b/stable/telegraf/templates/service.yaml new file mode 100644 index 0000000000..cc0d19b95d --- /dev/null +++ b/stable/telegraf/templates/service.yaml @@ -0,0 +1,42 @@ +{{- if .Values.single.enabled -}} +{{- if .Values.single.service.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }}-s + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" +spec: + type: {{ .Values.single.service.type }} + ports: + {{- range $key, $value := .Values.single.config.inputs }} + {{- if eq $key "http_listener" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "http_listener" + {{- end }} + {{- if eq $key "statsd" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "statsd" + {{- end }} + {{- if eq $key "tcp_listener" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "tcp_listener" + {{- end }} + {{- if eq $key "udp_listener" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "udp_listener" + {{- end }} + {{- if eq $key "webhooks" }} + - port: {{ trimPrefix ":" $value.service_address | int64 }} + targetPort: {{ trimPrefix ":" $value.service_address | int64 }} + name: "webhooks" + {{- end }} + {{- end }} + selector: + app: {{ template "fullname" . }}-s +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml new file mode 100644 index 0000000000..33217e0b2a --- /dev/null +++ b/stable/telegraf/values.yaml @@ -0,0 +1,491 @@ +## Default values.yaml for Telegraf +## This is a YAML-formatted file. +## ref: https://hub.docker.com/r/library/telegraf/tags/ +image: + repo: "telegraf" + tag: "1.1.0-alpine" + pullPolicy: IfNotPresent + +## Configure the telegraf daemonset here. +## Resource limits and outputs can be set seperately +daemonset: + enabled: true + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + requests: + memory: 256Mi + cpu: 0.1 + limits: + memory: 2Gi + cpu: 1 + ## Exposed telegraf configuration + ## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ + config: +## global_tags: +## dc: "us-east-1" +## user: "$USER" + agent: + interval: "10s" + round_interval: true + metric_batch_size: 1000 + metric_buffer_limit: 10000 + collection_jitter: "0s" + flush_interval: "10s" + flush_jitter: "0s" + precision: "" + debug: false + quiet: false + logfile: "" + hostname: "" + omit_hostname: false + outputs: + influxdb: + urls: + - "http://influxdb-influxdb.tick:8086" + database: "telegraf" +## retention_policy: "" +## write_consistency: "any" +## timeout: "5s" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## user_agent: "telegraf" +## udp_payload: 512 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## amqp: +## url: "amqp://localhost:5672/influxdb" +## exchange: "telegraf" +## auth_method: "PLAIN" +## routing_tag: "host" +## retention_policy: "default" +## database: "telegraf" +## precision: "s" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## kafka: +## brokers: +## - "localhost:9092" +## topic: "telegraf" +## routing_tag: "host" +## compression_codec: 0 +## required_acks: -1 +## max_retry: 3 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## mqtt: +## servers: +## - "localhost:1883" +## topic_prefix: "telegraf" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nats: +## servers: +## - "nats://localhost:4222" +## username: "" +## password: "" +## subject: "telegraf" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nsq: +## server: "localhost:4150" +## topic: "telegraf" +## data_format: "influx" + inputs: + cpu: + percpu: true + totalcpu: true + collect_cpu_time: false + disk: + ignore_fs: + - "tmpfs" + - "devtmpfs" + diskio: + docker: + endpoint: "unix:///var/run/docker.sock" + container_names: [] + kernel: + mem: + processes: + swap: + system: + kubernetes: + url: "http://$NODE_IP:10255" + bearer_token: "/var/run/secrets/kubernetes.io/serviceaccount/token" + insecure_skip_verify: true + +## Configure the telegraf single instance here. +## Resource limits and outputs can be set seperately +single: + enabled: true + ## Configure resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + resources: + requests: + memory: 256Mi + cpu: 0.1 + limits: + memory: 2Gi + cpu: 1 + ## Configure the service for this telegraf instance. If you are running + ## Any of the service plugins you will need this enabled + ## Service Plugins: http_listener, statsd, tcp_listener, udp_listener + ## ref: http://kubernetes.io/docs/user-guide/services/ + service: + enabled: true + type: NodePort + + ## Exposed telegraf configuration + ## For full list of possible values see `/docs/all-config-values.yaml` and `/docs/all-config-values.toml` + ## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ + + config: +## global_tags: +## dc: "us-east-1" +## user: "$USER" + agent: + interval: "10s" + round_interval: true + metric_batch_size: 1000 + metric_buffer_limit: 10000 + collection_jitter: "0s" + flush_interval: "10s" + flush_jitter: "0s" + precision: "" + debug: false + quiet: false + logfile: "" + hostname: "" + omit_hostname: false + outputs: + influxdb: + urls: + - "http://influxdb-influxdb.tick:8086" + database: "telegraf" +## retention_policy: "" +## write_consistency: "any" +## timeout: "5s" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## user_agent: "telegraf" +## udp_payload: 512 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## amqp: +## url: "amqp://localhost:5672/influxdb" +## exchange: "telegraf" +## auth_method: "PLAIN" +## routing_tag: "host" +## retention_policy: "default" +## database: "telegraf" +## precision: "s" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## kafka: +## brokers: +## - "localhost:9092" +## topic: "telegraf" +## routing_tag: "host" +## compression_codec: 0 +## required_acks: -1 +## max_retry: 3 +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## mqtt: +## servers: +## - "localhost:1883" +## topic_prefix: "telegraf" +## username: "telegraf" +## password: "metricsmetricsmetricsmetrics" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nats: +## servers: +## - "nats://localhost:4222" +## username: "" +## password: "" +## subject: "telegraf" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## data_format: "influx" +## nsq: +## server: "localhost:4150" +## topic: "telegraf" +## data_format: "influx" + inputs: +## aerospike: +## servers: +## - "localhost:3000" +## apache: +## urls: +## - "http://localhost/server-status?auto" +## cassandra: +## context: "/jolokia/read" +## servers: +## - "myuser:mypassword@10.10.10.1:8778" +## - "10.10.10.2:8778" +## - ":8778" +## metrics : +## - "/java.lang:type=Memory/HeapMemoryUsage" +## - "/org.apache.cassandra.metrics:type=Table,keyspace=*,scope=*,name=ReadLatency" +## cloudwatch: +## region: "us-east-1" +## access_key: "" +## secret_key: "" +## token: "" +## role_arn: "" +## profile: "" +## shared_credential_file: "" +## period: "5m" +## delay: "5m" +## interval: "5m" +## cache_ttl: "10m" +## namespace: "AWS/ELB" +## ratelimit: 10 +## metrics: +## names: +## - "Latency" +## - "RequestCount" +## dimensions: +## name: "LoadBalancerName" +## value: "p-example" +## consul: +## address: "localhost" +## scheme: "http" +## token: "" +## username: "" +## password: "" +## datacentre: "" +## couchbase: +## servers: +## - "http://localhost:8091" +## couchdb: +## hosts: +## - "http://localhost:8086/_stats" +## disque: +## servers: +## - "localhost" +## dns_query: +## servers: +## - "8.8.8.8" +## domains: +## - "." +## record_type: "A" +## port: 53 +## timeout: 2 +## dovecot: +## servers: +## - "localhost:24242" +## type: "global" +## filters: +## - "" +## elasticsearch: +## servers: +## - "http://localhost:9200" +## http_timeout: "5s" +## local: true +## cluster_health: false +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## graylog: +## servers: +## - "http://[graylog-server-ip]:12900/system/metrics/multiple" +## metrics: +## - "jvm.cl.loaded" +## - "jvm.memory.pools.Metaspace.committed" +## username: "" +## password: "" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## haproxy: +## servers: +## - "http://myhaproxy.com:1936/haproxy?stats" + influxdb: + urls: + - "http://influxdb-influxdb.tick:8086/debug/vars" + timeout: "5s" +## lustre2: +## ost_procfiles: +## - "/proc/fs/lustre/obdfilter/*/stats" +## - "/proc/fs/lustre/osd-ldiskfs/*/stats" +## - "/proc/fs/lustre/obdfilter/*/job_stats" +## mds_procfiles: +## - "/proc/fs/lustre/mdt/*/md_stats" +## - "/proc/fs/lustre/mdt/*/job_stats" +## mailchimp: +## api_key: "" +## days_old: 0 +## campaign_id: "" +## memcached: +## servers: +## - "localhost:11211" +## unix_sockets: +## - "/var/run/memcached.sock" +## mesos: +## timeout: 100 +## masters: +## - "localhost:5050" +## master_collections: +## - "resources" +## - "master" +## - "system" +## - "agents" +## - "frameworks" +## - "tasks" +## - "messages" +## - "evqueue" +## - "registrar" +## slaves: +## - +## slave_collections: +## - "resources" +## - "agent" +## - "system" +## - "executors" +## - "tasks" +## - "messages" +## mongodb: +## servers: +## - "mongodb://user:password@127.0.0.1:27017" +## gather_perdb_stats: false +## mysql: +## servers: +## - "tcp(127.0.0.1:3306)?tls=false" +## perf_events_statements_digest_text_limit : 120 +## perf_events_statements_limit: 250 +## perf_events_statements_time_limit : 86400 +## table_schema_databases: [] +## gather_table_schema: false +## gather_process_list: true +## gather_info_schema_auto_inc: true +## gather_slave_status: true +## gather_binary_logs: false +## gather_table_io_waits: false +## gather_table_lock_waits: false +## gather_index_io_waits: false +## gather_event_waits: false +## gather_file_events_stats: false +## gather_perf_events_statements: false +## interval_slow: "30m" +## net_response: +## protocol: "tcp" +## address: "github.com:80" +## timeout: "1s" +## send: "ssh" +## expect: "ssh" +## read_timeout: "1s" +## nginx: +## urls: +## - "http://nginx.nginx-ingress/nginx_status" +## nsq: +## endpoints: +## - "http://localhost:4151" +## phpfpm: +## urls: +## - "http://localhost/status" +## ping: +## urls: +## - "www.google.com" +## count: 1 +## ping_interval: 1.0 +## timeout: 1.0 +## interface: "" +## postgresql: +## address: "postgres://user:password@localhost?sslmode=disable" +## ignored_databases: +## - "postgres" +## databases: +## - "app_production" +## - "testing" + prometheus: + urls: + - "https://kubernetes.default:443/metrics" + name_prefix: "prom_" + bearer_token: "/var/run/secrets/kubernetes.io/serviceaccount/token" + insecure_skip_verify: true +## ssl_ca: /path/to/cafile +## ssl_cert: /path/to/certfile +## ssl_key: /path/to/keyfile +## rabbitmq: +## url: "http://localhost:15672" +## name: "rmq-server-1" +## username: "guest" +## password: "guest" +## ssl_ca: "/etc/telegraf/ca.pem" +## ssl_cert: "/etc/telegraf/cert.pem" +## ssl_key: "/etc/telegraf/key.pem" +## insecure_skip_verify: false +## nodes: +## - "rabbit@node1" +## - "rabbit@node2" +## raindrops: +## urls: +## - "http://localhost:8080/_raindrops" +## redis: +## servers: +## - "tcp://localhost:6379" +## rethinkdb: +## servers: +## - "127.0.0.1:28015" +## riak: +## servers: +## - "http://localhost:8098" +## sqlserver: +## servers: +## - "Server=192.168.1.10;Port=1433;User Id=;Password=;app name=telegraf;log=1;" +## twemproxy: +## addr: "localhost:22222" +## pools: +## - "redis_pool" +## - "mc_pool" +## zookeeper: +## servers: +## - "localhost:2181" +## http_listener: +## service_address: ":8186" +## read_timeout: "10s" +## write_timeout: "10s" +## max_body_size: 0 +## max_line_size: 0 + statsd: + service_address: ":8125" + percentiles: + - 50 + - 95 + - 99 + metric_separator: "_" + allowed_pending_messages: 10000 + percentile_limit: 1000 \ No newline at end of file From f091a6271ccf12a987a0d3731e626ac8aba0e6bf Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Thu, 1 Dec 2016 07:37:35 -0800 Subject: [PATCH 02/12] Add NOTES.txt --- stable/telegraf/templates/NOTES.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 stable/telegraf/templates/NOTES.txt diff --git a/stable/telegraf/templates/NOTES.txt b/stable/telegraf/templates/NOTES.txt new file mode 100644 index 0000000000..021d2a09ef --- /dev/null +++ b/stable/telegraf/templates/NOTES.txt @@ -0,0 +1,28 @@ +Telegraf's statsd service can be accessed via port {{ .Values.inputs.statsd.bind_address }} on the following DNS name from within your cluster: + +- http://{{ template "fullname" . }}.{{ .Release.Namespace }} + +You can easily connect to the remote instance from your browser. Forward the webserver port to localhost:8888 + +- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') 8888:80 + +You can also connect to the container running Telegraf. To open a shell session in the pod run the following: + +- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh + +To trail the logs for the Telegraf pod run the following: + +- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') + +{{- if eq .Values.service.type "LoadBalancer" }} + +To watch for the LoadBalancer IP run the following + +- kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} +{{- end }} +{{- if .Values.ingress.enabled }} + +Telegraf will be available at the following IP + +- http://{{ .Values.ingress.hostname }} +{{- end -}} \ No newline at end of file From 99ecbbf5060c6b37d16712af70f247cadd299cb3 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Thu, 1 Dec 2016 09:52:39 -0800 Subject: [PATCH 03/12] Update README.md --- stable/telegraf/README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/stable/telegraf/README.md b/stable/telegraf/README.md index 543f839c5c..ce9b87f06d 100644 --- a/stable/telegraf/README.md +++ b/stable/telegraf/README.md @@ -40,32 +40,32 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration -The following tables lists the configurable parameters of the Telegraf chart and their default values. +The following tables lists the configurable parameters of the Telegraf chart and includes brief explanation. The defaults are listed in `values.yaml`: ```yaml ## Image -image.repo: "telegraf" -image.tag: "1.1.0-alpine" -image.pullPolicy: IfNotPresent +image.repo: Docker image repository +image.tag: Docker image tag +image.pullPolicy: Kubernetes pull policy for docker image ## Daemonset - configuration for telegraf instances running as daemonset -daemonset.enabled: true +daemonset.enabled: Toggle daemonset on or off # resource requests and limits for the daemonset -daemonset.resources.requests.memory: 256Mi -daemonset.resources.requests.cpu: 0.1 -daemonset.resources.limits.memory: 2Gi -daemonset.resources.limits.cpu: 1 +daemonset.resources.requests.memory: Min memory for this resource +daemonset.resources.requests.cpu: Min cpu for this pod +daemonset.resources.limits.memory: Max memory for this resource +daemonset.resources.limits.cpu: Max cpu for this pod ## Exposed telegraf configuration ## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ daemonset.config: # See Telegraf Configuration ## Single - configuration for telegraf instances running as deployment single.enabled: true # resource requests and limits for the single instance -single.resources.requests.memory: 256Mi -single.resources.requests.cpu: 0.1 -single.resources.limits.memory: 2Gi -single.resources.limits.cpu: 1 -single.service.enabled: true -single.service.type: NodePort +single.resources.requests.memory: Min memory for this resource +single.resources.requests.cpu: Min cpu for this pod +single.resources.limits.memory: Max memory for this resource +single.resources.limits.cpu: Max cpu for this pod +single.service.enabled: This enables the service to expose any listeners from telegraf +single.service.type: Service type for telegraf service ## Exposed telegraf configuration ## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ single.config: # see Telegraf Configuration From 7605e389fe724553ca8ed4c0f90491dc518cc47b Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Fri, 2 Dec 2016 08:00:55 -0800 Subject: [PATCH 04/12] Fix NOTES.txt errors --- stable/telegraf/templates/NOTES.txt | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/stable/telegraf/templates/NOTES.txt b/stable/telegraf/templates/NOTES.txt index 021d2a09ef..10cffeb3a3 100644 --- a/stable/telegraf/templates/NOTES.txt +++ b/stable/telegraf/templates/NOTES.txt @@ -1,12 +1,4 @@ -Telegraf's statsd service can be accessed via port {{ .Values.inputs.statsd.bind_address }} on the following DNS name from within your cluster: - -- http://{{ template "fullname" . }}.{{ .Release.Namespace }} - -You can easily connect to the remote instance from your browser. Forward the webserver port to localhost:8888 - -- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') 8888:80 - -You can also connect to the container running Telegraf. To open a shell session in the pod run the following: +To open a shell session in the container running Telegraf run the following: - kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh @@ -14,15 +6,9 @@ To trail the logs for the Telegraf pod run the following: - kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') -{{- if eq .Values.service.type "LoadBalancer" }} +{{- if eq .Values.single.service.type "LoadBalancer" }} To watch for the LoadBalancer IP run the following - kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -{{- end }} -{{- if .Values.ingress.enabled }} - -Telegraf will be available at the following IP - -- http://{{ .Values.ingress.hostname }} -{{- end -}} \ No newline at end of file +{{- end }} \ No newline at end of file From 67b4471400addccb17a6ce8cf08b6e42bfa7b578 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Sat, 3 Dec 2016 11:11:19 -0800 Subject: [PATCH 05/12] Fix hostname change on redeploy --- stable/telegraf/templates/daemonset.yaml | 2 +- stable/telegraf/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stable/telegraf/templates/daemonset.yaml b/stable/telegraf/templates/daemonset.yaml index 8cc7e6c4b7..ce4de8444e 100644 --- a/stable/telegraf/templates/daemonset.yaml +++ b/stable/telegraf/templates/daemonset.yaml @@ -20,7 +20,7 @@ spec: resources: {{ toYaml .Values.daemonset.resources | indent 10 }} env: - - name: NODE_IP + - name: HOSTNAME valueFrom: fieldRef: fieldPath: spec.nodeName diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml index 33217e0b2a..adfe125537 100644 --- a/stable/telegraf/values.yaml +++ b/stable/telegraf/values.yaml @@ -171,7 +171,7 @@ single: debug: false quiet: false logfile: "" - hostname: "" + hostname: "telegraf-polling-service" omit_hostname: false outputs: influxdb: From 1b73ccf53ce8ce77704506e6cac41d1dbf04a15e Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Mon, 5 Dec 2016 11:43:22 -0800 Subject: [PATCH 06/12] NodePort -> ClusterIP and remove values.yaml from README.md' --- stable/telegraf/README.md | 33 +-------------------------------- stable/telegraf/values.yaml | 2 +- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/stable/telegraf/README.md b/stable/telegraf/README.md index ce9b87f06d..9b7c72f9cf 100644 --- a/stable/telegraf/README.md +++ b/stable/telegraf/README.md @@ -40,38 +40,7 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration -The following tables lists the configurable parameters of the Telegraf chart and includes brief explanation. The defaults are listed in `values.yaml`: - -```yaml -## Image -image.repo: Docker image repository -image.tag: Docker image tag -image.pullPolicy: Kubernetes pull policy for docker image -## Daemonset - configuration for telegraf instances running as daemonset -daemonset.enabled: Toggle daemonset on or off -# resource requests and limits for the daemonset -daemonset.resources.requests.memory: Min memory for this resource -daemonset.resources.requests.cpu: Min cpu for this pod -daemonset.resources.limits.memory: Max memory for this resource -daemonset.resources.limits.cpu: Max cpu for this pod -## Exposed telegraf configuration -## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ -daemonset.config: # See Telegraf Configuration -## Single - configuration for telegraf instances running as deployment -single.enabled: true -# resource requests and limits for the single instance -single.resources.requests.memory: Min memory for this resource -single.resources.requests.cpu: Min cpu for this pod -single.resources.limits.memory: Max memory for this resource -single.resources.limits.cpu: Max cpu for this pod -single.service.enabled: This enables the service to expose any listeners from telegraf -single.service.type: Service type for telegraf service -## Exposed telegraf configuration -## ref: https://docs.influxdata.com/telegraf/v1.1/administration/configuration/ -single.config: # see Telegraf Configuration -``` - -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, +The default configuration parameters are listed in `values.yaml`. To change the defaults, specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, ```console $ helm install --name my-release \ diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml index adfe125537..c420d53e44 100644 --- a/stable/telegraf/values.yaml +++ b/stable/telegraf/values.yaml @@ -149,7 +149,7 @@ single: ## ref: http://kubernetes.io/docs/user-guide/services/ service: enabled: true - type: NodePort + type: ClusterIP ## Exposed telegraf configuration ## For full list of possible values see `/docs/all-config-values.yaml` and `/docs/all-config-values.toml` From bf7ecdb5cf66a186f868c1c5e8d64fdd7684e93d Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Mon, 5 Dec 2016 13:15:05 -0800 Subject: [PATCH 07/12] Fix NOTES.txt --- stable/telegraf/templates/NOTES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stable/telegraf/templates/NOTES.txt b/stable/telegraf/templates/NOTES.txt index 10cffeb3a3..4b49f7e4db 100644 --- a/stable/telegraf/templates/NOTES.txt +++ b/stable/telegraf/templates/NOTES.txt @@ -2,9 +2,9 @@ To open a shell session in the container running Telegraf run the following: - kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{.items[0].metadata.name}') /bin/sh -To trail the logs for the Telegraf pod run the following: +To tail the logs for a Telegraf pod in the Daemonset run the following: -- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -o jsonpath='{ .items[0].metadata.name }') +- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }}-ds -o jsonpath='{ .items[0].metadata.name }') {{- if eq .Values.single.service.type "LoadBalancer" }} From 71945766294b7eb10a550d94fc0d731611cabf0f Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Wed, 7 Dec 2016 16:58:59 -0800 Subject: [PATCH 08/12] Make deployment not work unless influxdb url is set --- stable/telegraf/templates/NOTES.txt | 2 +- stable/telegraf/templates/configmap-s.yaml | 2 ++ stable/telegraf/templates/conifgmap-ds.yaml | 2 ++ stable/telegraf/templates/daemonset.yaml | 2 ++ stable/telegraf/templates/deployment.yaml | 2 ++ stable/telegraf/templates/service.yaml | 2 ++ stable/telegraf/values.yaml | 8 ++++---- 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/stable/telegraf/templates/NOTES.txt b/stable/telegraf/templates/NOTES.txt index 4b49f7e4db..26d1881de5 100644 --- a/stable/telegraf/templates/NOTES.txt +++ b/stable/telegraf/templates/NOTES.txt @@ -11,4 +11,4 @@ To tail the logs for a Telegraf pod in the Daemonset run the following: To watch for the LoadBalancer IP run the following - kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/stable/telegraf/templates/configmap-s.yaml b/stable/telegraf/templates/configmap-s.yaml index fb203c9398..9cd61540ba 100644 --- a/stable/telegraf/templates/configmap-s.yaml +++ b/stable/telegraf/templates/configmap-s.yaml @@ -1,3 +1,4 @@ +{{- if gt (len .Values.single.config.outputs.influxdb.urls) 0 }} {{- if .Values.single.enabled -}} apiVersion: v1 kind: ConfigMap @@ -14,4 +15,5 @@ data: {{ template "agent" .Values.single.config.agent }} {{ template "outputs" .Values.single.config.outputs }} {{ template "inputs" .Values.single.config.inputs -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/conifgmap-ds.yaml b/stable/telegraf/templates/conifgmap-ds.yaml index ebc7fa45de..1c7efff333 100644 --- a/stable/telegraf/templates/conifgmap-ds.yaml +++ b/stable/telegraf/templates/conifgmap-ds.yaml @@ -1,3 +1,4 @@ +{{- if gt (len .Values.daemonset.config.outputs.influxdb.urls) 0 }} {{- if .Values.daemonset.enabled -}} apiVersion: v1 kind: ConfigMap @@ -14,4 +15,5 @@ data: {{ template "agent" .Values.daemonset.config.agent }} {{ template "outputs" .Values.daemonset.config.outputs }} {{ template "inputs" .Values.daemonset.config.inputs -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/daemonset.yaml b/stable/telegraf/templates/daemonset.yaml index ce4de8444e..2cac86e94e 100644 --- a/stable/telegraf/templates/daemonset.yaml +++ b/stable/telegraf/templates/daemonset.yaml @@ -1,3 +1,4 @@ +{{- if gt (len .Values.daemonset.config.outputs.influxdb.urls) 0 }} {{- if .Values.daemonset.enabled -}} apiVersion: extensions/v1beta1 kind: DaemonSet @@ -59,4 +60,5 @@ spec: - name: config configMap: name: {{ template "fullname" . }}-ds +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/deployment.yaml b/stable/telegraf/templates/deployment.yaml index ed8ca758a0..01f488e487 100644 --- a/stable/telegraf/templates/deployment.yaml +++ b/stable/telegraf/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- if gt (len .Values.single.config.outputs.influxdb.urls) 0 }} {{- if .Values.single.enabled -}} apiVersion: extensions/v1beta1 kind: Deployment @@ -27,4 +28,5 @@ spec: - name: config configMap: name: {{ template "fullname" . }}-s +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/stable/telegraf/templates/service.yaml b/stable/telegraf/templates/service.yaml index cc0d19b95d..526f9663e4 100644 --- a/stable/telegraf/templates/service.yaml +++ b/stable/telegraf/templates/service.yaml @@ -1,3 +1,4 @@ +{{- if gt (len .Values.single.config.outputs.influxdb.urls) 0 }} {{- if .Values.single.enabled -}} {{- if .Values.single.service.enabled -}} apiVersion: v1 @@ -39,4 +40,5 @@ spec: selector: app: {{ template "fullname" . }}-s {{- end -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml index c420d53e44..00e9752300 100644 --- a/stable/telegraf/values.yaml +++ b/stable/telegraf/values.yaml @@ -41,8 +41,8 @@ daemonset: omit_hostname: false outputs: influxdb: - urls: - - "http://influxdb-influxdb.tick:8086" + urls: [] + # - "http://influxdb-influxdb.tick:8086" database: "telegraf" ## retention_policy: "" ## write_consistency: "any" @@ -175,8 +175,8 @@ single: omit_hostname: false outputs: influxdb: - urls: - - "http://influxdb-influxdb.tick:8086" + urls: [] + # - "http://influxdb-influxdb.tick:8086" database: "telegraf" ## retention_policy: "" ## write_consistency: "any" From 5699868aafd78c6193f127f5f5f35fac44539504 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 13 Dec 2016 13:13:42 -0800 Subject: [PATCH 09/12] Fix kubenetes plugin and deploy only service by default --- stable/telegraf/templates/service.yaml | 2 -- stable/telegraf/values.yaml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/stable/telegraf/templates/service.yaml b/stable/telegraf/templates/service.yaml index 526f9663e4..cc0d19b95d 100644 --- a/stable/telegraf/templates/service.yaml +++ b/stable/telegraf/templates/service.yaml @@ -1,4 +1,3 @@ -{{- if gt (len .Values.single.config.outputs.influxdb.urls) 0 }} {{- if .Values.single.enabled -}} {{- if .Values.single.service.enabled -}} apiVersion: v1 @@ -40,5 +39,4 @@ spec: selector: app: {{ template "fullname" . }}-s {{- end -}} -{{- end -}} {{- end -}} \ No newline at end of file diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml index 00e9752300..b2b4fb56c7 100644 --- a/stable/telegraf/values.yaml +++ b/stable/telegraf/values.yaml @@ -126,7 +126,7 @@ daemonset: swap: system: kubernetes: - url: "http://$NODE_IP:10255" + url: "http://$HOSTNAME:10255" bearer_token: "/var/run/secrets/kubernetes.io/serviceaccount/token" insecure_skip_verify: true From db8acdfc3dc0b14a42e7a597316d38ac766f03cb Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 13 Dec 2016 13:21:39 -0800 Subject: [PATCH 10/12] Add hostname for telegraf-ds --- stable/telegraf/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml index b2b4fb56c7..62693bd453 100644 --- a/stable/telegraf/values.yaml +++ b/stable/telegraf/values.yaml @@ -37,7 +37,7 @@ daemonset: debug: false quiet: false logfile: "" - hostname: "" + hostname: "$HOSTNAME" omit_hostname: false outputs: influxdb: From 41ab2c39be1174b76438ff266a78057a949dd0b0 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 13 Dec 2016 15:58:54 -0800 Subject: [PATCH 11/12] Fix service names --- stable/telegraf/templates/service.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stable/telegraf/templates/service.yaml b/stable/telegraf/templates/service.yaml index cc0d19b95d..dad0685032 100644 --- a/stable/telegraf/templates/service.yaml +++ b/stable/telegraf/templates/service.yaml @@ -13,19 +13,19 @@ spec: {{- if eq $key "http_listener" }} - port: {{ trimPrefix ":" $value.service_address | int64 }} targetPort: {{ trimPrefix ":" $value.service_address | int64 }} - name: "http_listener" + name: "http-listener" {{- end }} {{- if eq $key "statsd" }} - port: {{ trimPrefix ":" $value.service_address | int64 }} targetPort: {{ trimPrefix ":" $value.service_address | int64 }} name: "statsd" {{- end }} - {{- if eq $key "tcp_listener" }} + {{- if eq $key "tcp-listener" }} - port: {{ trimPrefix ":" $value.service_address | int64 }} targetPort: {{ trimPrefix ":" $value.service_address | int64 }} name: "tcp_listener" {{- end }} - {{- if eq $key "udp_listener" }} + {{- if eq $key "udp-listener" }} - port: {{ trimPrefix ":" $value.service_address | int64 }} targetPort: {{ trimPrefix ":" $value.service_address | int64 }} name: "udp_listener" From cc7682daf8fd994887916c3149e3239d605e73b9 Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Thu, 15 Dec 2016 11:19:47 -0800 Subject: [PATCH 12/12] Add note if .Values.daemonset.config.outputs.influxdb.url isn't set --- stable/telegraf/templates/NOTES.txt | 11 +++++++++++ stable/telegraf/values.yaml | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/stable/telegraf/templates/NOTES.txt b/stable/telegraf/templates/NOTES.txt index 26d1881de5..d98cf612e4 100644 --- a/stable/telegraf/templates/NOTES.txt +++ b/stable/telegraf/templates/NOTES.txt @@ -12,3 +12,14 @@ To watch for the LoadBalancer IP run the following - kubectl get svc -w --namespace {{ .Release.Namespace }} -l app={{ template "fullname" . }} {{- end }} + +{{- if empty .Values.single.config.outputs.influxdb.urls }} +{{- if empty .Values.daemonset.config.outputs.influxdb.urls }} + +Need to set an InfluxDB url for either single or daemonset to deploy this instance: + +.Values.daemonset.config.outputs.influxdb.urls +.Values.single.config.outputs.influxdb.urls + +{{- end }} +{{- end }} \ No newline at end of file diff --git a/stable/telegraf/values.yaml b/stable/telegraf/values.yaml index 62693bd453..8e94bef65d 100644 --- a/stable/telegraf/values.yaml +++ b/stable/telegraf/values.yaml @@ -242,6 +242,10 @@ single: ## topic: "telegraf" ## data_format: "influx" inputs: + cpu: + percpu: false + totalcpu: true + system: ## aerospike: ## servers: ## - "localhost:3000"