Kubernetes

Supported version: Till 1.29 Server

API Rate Limit: No limit

IMPORTANT: Please make sure your Kubernetes instance must be accessible from the Gathr Analytics Machine.

Supported Authentication: Token- based authentication

How to generate Kubernetes token :

In order to generate the Kubernetes token, you need to follow below steps:

  1. Choose your k8s cluster:

kubectl config use-context my_cluster_name

  1. Make default account the cluster administrator:

kubectl create clusterrolebinding default-admin –clusterrole cluster-admin –serviceaccount=default:default -n default

  1. Fetch Host IP detail:

    export CURRENT_CONTEXT=$(kubectl config current-context) && export CURRENT_CLUSTER=$(kubectl config view -o go-template="{{$curr_context := "$CURRENT_CONTEXT" }}{{range .contexts}}{{if eq .name $curr_context}}{{.context.cluster}}{{end}}{{end}}") && echo $(kubectl config view -o go-template="{{$cluster_context := "$CURRENT_CLUSTER"}}{{range .clusters}}{{if eq .name $cluster_context}}{{.cluster.server}}{{end}}{{end}}")

NOTE: Use the IP generated by this command to configure the datasource in Gathr Analytics in the later section of this article.

  1. Get Kubernetes bearer token:

    echo $(kubectl get secret -o go-template=’{{index .data “token” }}’ $(kubectl get sa default -o go-template="{{range .secrets}}{{.name}}{{end}}")) | base64 –decode

NOTE: Save the generated Bearer Token to configure the datasource in Gathr Analytics in the later section of this article.

Configure Kubernetes Datasource on Gathr Analytics :

To configure Kubernetes Connector using token based authentication:

  1. Enter Kubernetes URL : For example: https://172.50.0.1:6443
  2. Select “Create New Account” and add user friendly name for account “Kubernetes Account”
  3. Check “Pass Parameter(s) in Header” and enter followings:
    • Token Parameter Key : “Authorization”
    • value : Bearer
  4. Click on “Save”.

NOTE: The token used in the image is the sample token and the length of your generated token may vary.

Top