-
-
Save ShakataGaNai/88dba05201e4c8f7def66440922a1bc3 to your computer and use it in GitHub Desktop.
more up to date telegraf daemonset example (to InfluxDB 2.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: telegraf | |
namespace: kube-system | |
labels: | |
k8s-app: telegraf | |
data: | |
telegraf.conf: |+ | |
[agent] | |
hostname = "$KUBELET_HOST" | |
[[outputs.influxdb_v2]] | |
urls = ["http://YOUR-INFLUXDB-INSTALL-HERE"] | |
token = "$INFLUX_TOKEN" | |
organization = "YOUR-ORGANIZATION-HERE" | |
bucket = "YOUR-BUCKET-HERE" | |
[[inputs.cpu]] | |
percpu = true | |
totalcpu = true | |
collect_cpu_time = false | |
report_active = false | |
[[inputs.disk]] | |
ignore_fs = ["tmpfs", "devtmpfs", "devfs"] | |
[[inputs.diskio]] | |
[[inputs.kernel]] | |
[[inputs.mem]] | |
[[inputs.processes]] | |
[[inputs.swap]] | |
[[inputs.system]] | |
[[inputs.docker]] | |
endpoint = "unix:///var/run/docker.sock" | |
[[inputs.kubernetes]] | |
url = "http://$KUBELET_HOST:10255" | |
--- | |
# Section: Daemonset | |
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: telegraf | |
namespace: kube-system | |
labels: | |
k8s-app: telegraf | |
spec: | |
selector: | |
matchLabels: | |
name: telegraf | |
template: | |
metadata: | |
labels: | |
name: telegraf | |
spec: | |
containers: | |
- name: telegraf | |
image: docker.io/telegraf:1.10.4-alpine | |
resources: | |
limits: | |
memory: 500Mi | |
requests: | |
cpu: 500m | |
memory: 500Mi | |
env: | |
- name: HOSTNAME | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
- name: "HOST_PROC" | |
value: "/rootfs/proc" | |
- name: "HOST_SYS" | |
value: "/rootfs/sys" | |
- name: INFLUX_TOKEN | |
valueFrom: | |
secretKeyRef: | |
name: telegraf | |
key: INFLUX_TOKEN | |
- name: KUBELET_HOST | |
valueFrom: | |
fieldRef: | |
fieldPath: spec.nodeName | |
volumeMounts: | |
- name: sys | |
mountPath: /rootfs/sys | |
readOnly: true | |
- name: proc | |
mountPath: /rootfs/proc | |
readOnly: true | |
- name: docker-socket | |
mountPath: /var/run/docker.sock | |
readOnly: true | |
- name: utmp | |
mountPath: /var/run/utmp | |
readOnly: true | |
- name: config | |
mountPath: /etc/telegraf | |
terminationGracePeriodSeconds: 30 | |
volumes: | |
- name: sys | |
hostPath: | |
path: /sys | |
- name: docker-socket | |
hostPath: | |
path: /var/run/docker.sock | |
- name: proc | |
hostPath: | |
path: /proc | |
- name: utmp | |
hostPath: | |
path: /var/run/utmp | |
- name: config | |
configMap: | |
name: telegraf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll also need to create the secret
INFLUX_TOKEN
, optionally with another YAML: