Failed to deploy Telegraf
hongbo-miao opened this issue · 3 comments
I am trying to deploy Telegraf by its helm chart to Kubernetes.
However, when I follow the readme by https://github.com/influxdata/helm-charts
helm repo add influxdata https://helm.influxdata.com/
helm upgrade --install my-release influxdata/telegraf
I got error
Failed to pull image "telegraf:1.24-alpine": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/library/telegraf:1.24-alpine": no match for platform in manifest: not found
Usually, the image name is docker.io/someOrganization/telegraf:1.24-alpine
, however, Telegraf image is not under an org at https://hub.docker.com/_/telegraf
I am thinking should docker.io/library/telegraf:1.24-alpine
be docker.io/telegraf:1.24-alpine
?
Any idea? Thanks! 😃
Once I change from official image telegraf
to bitnami/telegraf
by
helm install \
telegraf \
influxdata/telegraf \
--values=my-values.yaml
my-values.yaml:
# Based on https://github.com/influxdata/helm-charts/blob/master/charts/telegraf/values.yaml
image:
repo: "bitnami/telegraf"
tag: "1.24.3"
outputs:
- influxdb_v2:
urls:
- "http://influxdb.hm-influxdb:8086"
token: "xxx"
organization: "primary"
bucket: "primary"
The previous image not found issue will be fixed, however, I got a new error:
Error: INSTALLATION FAILED: Service "telegraf" is invalid: spec.ports: Required value
This error means Kubernetes Service has to expose a port, apparently Telegraf installed by this helm chart does not expose a port by default.
Also, I have container error log:
NAME:
Telegraf - The plugin-driven server agent for collecting & reporting metrics.
USAGE:
Telegraf [global options] command [command options] [arguments...]
COMMANDS:
config print out full sample configuration to stdout
version print current version to stdout
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--aggregator-filter value filter the aggregators to enable, separator is ':'
--config value [ --config value ] configuration file to load
--config-directory value [ --config-directory value ] directory containing additional *.conf files
--debug turn on debug logging (default: false)
--deprecation-list print all deprecated plugins or plugin options (default: false)
--help, -h show help (default: false)
--input-filter value filter the inputs to enable, separator is ':'
--input-list print available input plugins (default: false)
--once run one gather and exit (default: false)
--output-filter value filter the outputs to enable, separator is ':'
--output-list print available output plugins (default: false)
Due to I met too many issues for this helm chart, I currently temporally end up with writing my own Kubernetes YAML files:
telegraf/telegraf-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: telegraf-deployment
labels:
app.kubernetes.io/name: telegraf
spec:
replicas: 1
selector:
matchLabels:
app: telegraf
template:
metadata:
labels:
app: telegraf
spec:
containers:
- name: telegraf
image: telegraf:1.24.3
ports:
- name: telegraf
protocol: TCP
containerPort: 8094
volumeMounts:
- name: telegraf-configmap-volume
mountPath: /etc/telegraf/
volumes:
- name: telegraf-configmap-volume
configMap:
name: telegraf-configmap
telegraf/telegraf-service.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: telegraf-deployment
labels:
app.kubernetes.io/name: telegraf
spec:
replicas: 1
selector:
matchLabels:
app: telegraf
template:
metadata:
labels:
app: telegraf
spec:
containers:
- name: telegraf
image: telegraf:1.24.3
ports:
- name: telegraf
protocol: TCP
containerPort: 8094
volumeMounts:
- name: telegraf-configmap-volume
mountPath: /etc/telegraf/
volumes:
- name: telegraf-configmap-volume
configMap:
name: telegraf-configmap
telegraf/telegraf-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: telegraf-configmap
namespace: hm-telegraf
labels:
app.kubernetes.io/name: telegraf
data:
telegraf.conf: |
[[outputs.influxdb_v2]]
urls = ["http://influxdb.hm-influxdb:8086"]
token = "xxx"
organization = "primary"
bucket = "primary"
Then I can succeed installing by
kubectl apply --filename=telegraf
However, this is my temp solution, hope the issues in the Telegraf helm chart can be resolved soon! 😃
To help reproduce, add more info, I am using the Kubernetes cluster created by Rancher Desktop v1.6.2
Kubernetes v1.24.6