influxdata / helm-charts

Official Helm Chart Repository for InfluxData Applications
MIT License
227 stars 329 forks source link

Error: Service "telegraf" is invalid: spec.ports: Required value #326

Closed anwareset closed 3 years ago

anwareset commented 3 years ago

Here is my values.yaml

rbac:
  create: true
  clusterWide: true
  rules:
    - apiGroups:
        - "*"
      resources:
        - "*"
      verbs:
        - "*"
    - nonResourceURLs:
        - "*"
      verbs:
        - "get"
        - "list"
        - "watch"
config:
  outputs:
    - influxdb_v2:
        urls:
          - "http://influxdb.influxdb.svc.cluster.local:8086"
        bucket: "influxdb"
        token: "hpkusiZ6GT32S6Yl7Q_lkY7v0-6YiNlX9sTsloW5HZmAdtTuKJneVoLNODwm46cfPvTbpxPpA3Y9K38NI3Uj5Q=="
        organization: "influxdb"
  inputs:
    - kube_inventory:
        url: "https://kubernetes.default"
        bearer_token: "/run/secrets/kubernetes.io/serviceaccount/token"
        insecure_skip_verify: true

And I just try to install with this command

helm upgrade --install telegraf -f values.yaml influxdata/telegraf

Then the output will be like this

Release "telegraf" does not exist. Installing it now.
Error: Service "telegraf" is invalid: spec.ports: Required value

I try to get logs from the telegraf pod

kubectl logs -f telegraf-58845d7788-b7c94

The output is like this

2021-06-09T06:11:54Z I! Starting Telegraf 1.17.3         
2021-06-09T06:11:54Z I! Using config file: /etc/telegraf/telegraf.conf
2021-06-09T06:11:54Z I! Loaded inputs: internal kube_inventory
2021-06-09T06:11:54Z I! Loaded aggregators: 
2021-06-09T06:11:54Z I! Loaded processors: enum
2021-06-09T06:11:54Z I! Loaded outputs: influxdb_v2
2021-06-09T06:11:54Z I! Tags enabled: host=telegraf-polling-service
2021-06-09T06:11:54Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"telegraf-polling-service", Flush Interval:10s

The helm upgrade --install command shows Error message, but the UI seems works fine. 2021-06-09-131817_1600x900_scrot

anwareset commented 3 years ago

The workaround is set the service to disabled inside values.yaml since I don't need service for telegraf.

service:
  enabled: false

Or It should looks like this when we need to enable it.

service:
  enabled: true
  type: ClusterIP
metrics:
  health:
    enabled: true

Then the output of helm upgrade --install telegraf -f values.yaml influxdata/telegraf commands will be like this

NAME: telegraf
LAST DEPLOYED: Fri Jun 11 23:08:08 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
To open a shell session in the container running Telegraf run the following:

  kubectl exec -i -t $(kubectl get pods -l app.kubernetes.io/name=telegraf -o jsonpath='{.items[0].metadata.name}') /bin/sh

To view the logs for a Telegraf pod, run the following:

  kubectl logs -f $(kubectl get pods -l app.kubernetes.io/name=telegraf -o jsonpath='{ .items[0].metadata.name }')
mossad-zika commented 2 years ago

took me an hour to find, why not in documentation or open ?