apiVersion: v1 kind: ConfigMap metadata: name: telegraf-config data: telegraf.conf: |+ [[outputs.influxdb_v2]] urls = ["http://influxdb.default.svc.cluster.local:8086"] organization = "xslab-org" bucket = "xslab-bucket" token = "xslab-token" [[inputs.mqtt_consumer]] servers = ["rabbitmq.default.svc.cluster.local:1883"] qos = 0 topics = [ "temphum" ] data_format = "json" --- apiVersion: apps/v1 kind: Deployment metadata: name: telegraf spec: selector: matchLabels: app: telegraf minReadySeconds: 5 template: metadata: labels: app: telegraf spec: containers: - image: registry.xslab.co.kr/lecture/telegraf:1.30.3 name: telegraf ports: - containerPort: 8125 name: telegraf volumeMounts: - name: telegraf-config-volume mountPath: /etc/telegraf/telegraf.conf subPath: telegraf.conf readOnly: true volumes: - name: telegraf-config-volume configMap: name: telegraf-config --- apiVersion: v1 kind: Service metadata: name: telegraf spec: ports: - name: telegraf port: 8125 targetPort: 8125 nodePort: 30202 selector: app: telegraf type: NodePort