This is an alpine based image for running telegraf within a kubernetes cluster.
Telegraf configuration is based largely on a toml file that is passed in when the binary starts. The issue with doing this in a containerized environment is how can you "dynamically" build this file based on values passed into the container at runtime. Therefore, this image relies on a project called envtpl to produce the telegraf configuration file. It can take environment variables and through using go templates produce the necessary stanzas in the toml file to start telegraf. Currently, the go template only supports basic if checks and outputting values that have been set.
You must do 2 things if you want to receive host level metrics from telegraf.
-
- Set the volume mounts for both
/sysand/proc
- Set the volume mounts for both
-
- Set the environment variables
HOST_PROCandHOST_SYSto the values of where/sysand/procare mounted in the container. Example entries can be found in the manifest.
- Set the environment variables
There is a make file provided with the project that can build the image, push it to a registry, and deploy it to a kubernetes cluster.
DEIS_REGISTRY: leave blank for dockerhub otherwise provide a valid url likequay.ioBUILD_TAG: This is the tag that will be applied to the image when builtIMAGE_PREFIX: The account in the registry (quay.io/jchauncey)
info: Print out what information will be used to build the docker imagedocker-build: Builds the docker imagedocker-push: Pushes the image to the specified registrykube-delete: Remove the daemonset from kuberneteskube-create: Create the daemonset in kuberneteskube-update: Remove the daemonset and create a new one (this is useful for publishing new images)update-manifests: This is a helpful target that is used to generate a temporary manifest with the dev image set in theimagestanza.