kubernetes-app icon indicating copy to clipboard operation
kubernetes-app copied to clipboard

helm chart

Open renich opened this issue 6 years ago • 11 comments

Hello,

It would be awesome if one could just helm install it, eh? ;)

renich avatar Mar 02 '18 03:03 renich

@renich grafana chart is already in kubernetes stable/grafana But seem this application need some special config to access Kubernetes API.

thuandt avatar Mar 05 '18 09:03 thuandt

Yes. Any idea of what to do? I'm kind of stuck there.

renich avatar Mar 05 '18 15:03 renich

@renich there currently isn't support for templating this kind of deployment. The configs are stored inside a SQL database. Configuration is done using the Grafana UI or an api call to grafana. Grafana 5.0 has static datasources that could be installed with helm. Although I think it may get very messy since the configs for the kubernetes datasource are somewhat obfuscated from the user.

http://docs.grafana.org/administration/provisioning/#example-datasource-config-file

Your best bet would be to configure the datasource and get it working using the UI. Then output the json using the grafana api /api/datasources/:id

The static yaml file for this app will be something like this:

# config file version
apiVersion: 1

datasources:
  # <string, required> name of the datasource. Required
- name: example_kube
  # <string, required> datasource type. Required
  type: grafana-kubernetes-datasource
  # <string, required> access mode. direct or proxy. Required
  access: proxy
  # <int> org id. will default to orgId 1 if not specified
  orgId: 1
  # <string> url
  url: http://localhost:443
  # <string> database password, if used
  password: ""
  # <string> database user, if used
  user: ""
  # <string> database name, if used
  database: ""
  # <bool> enable/disable basic auth
  basicAuth: false
  # <string> basic auth username
  basicAuthUser: ""
  # <string> basic auth password
  basicAuthPassword: ""
  # <bool> enable/disable with credentials headers
  withCredentials: true
  # <bool> mark as default datasource. Max one per org
  isDefault: false
  # <map> fields that will be converted to json and stored in json_data
  jsonData:
    ds: example_prometheus
    keepCookies: []
    tlsAuth: true
    tlsAuthWithCACert: true
  secureJsonData:
    tlsCACert: "..."
    tlsClientCert: "..."
    tlsClientKey: "..."
  version: 1
  # <bool> allow users to edit datasources from the UI.
  editable: false

jtlisi avatar Mar 05 '18 18:03 jtlisi

Maybe I'm wrong but this application seem don't support "inCluster" discovery.

thuandt avatar Mar 06 '18 17:03 thuandt

@thuandt By that do you mean the application will automatically configure the cluster if the Grafana instance is running in the cluster?

jtlisi avatar Mar 13 '18 17:03 jtlisi

@jschill Yes. By default, if granfana run inside k8s cluster, we already have cert and token to access API server.

thuandt avatar Mar 14 '18 09:03 thuandt

@thuandt the issue is, the plugin code related to adding a Kubernetes cluster is executed on the front end. So we can not take advantage of the inCluster configuration.

jtlisi avatar Mar 14 '18 16:03 jtlisi

Just an FYI: I added the kube datasource by running kubectl as a second container in the same pod as grafana. Just run kubectl proxy --port 8888 and it will handle the token stuff. Then you can just add http://localhost:8888 as the API location. Makes it very simple.

Timbus avatar Mar 24 '18 06:03 Timbus

I'm a bit confused. Is there any way of automatically installing this plugin within a kubernetes deploy?

Flowkap avatar May 08 '18 07:05 Flowkap

For extra clarity in @Timbus suggestion, the last argument should be --port

kubectl proxy --port 8888

Works good for me too

stigok avatar Jul 09 '18 12:07 stigok

Does the kubectl proxy solution require you to be running that proxy at all times, or just for the initial configuration?

tammersaleh avatar Sep 05 '19 23:09 tammersaleh