Skip to content

Configuration to monitor Kubernetes with the TICK stack

License

Notifications You must be signed in to change notification settings

hernrup-modelon/kube-influxdb

 
 

Repository files navigation

kube-influxdb - Monitor Kubernetes with the TICK stack

kube-influxdb is a set of configurations to set up monitoring of Kubernetes with InfluxData's TICK stack. It is implemented as a collection of pre-configured Helm charts and corresponding scripts to load Chronograf dashboards. This repo contains the following charts:

The create.sh script in the root of this repo is a helper script to deploy both the charts and their associated Chronograf dashboards.

kube-influxdb will work with open source Kubernetes deployed on EC2 as well as several managed Kubernetes services, including AWS' EKS, GCP's GKS, Red Hat's OpenShift. It can also be deployed locally using minikube.

Prerequisites

Note: For clusters running open source Kubernetes, this guide assumes the cluster has been deployed on AWS, e.g. using kops or a similar tool.

Set your kubectl context to point to an active EKS cluster where you would like to deploy TICK stack.

Install helm on your local development machine.

Run helm init to install tiller in your EKS cluster.

If running on AWS, open ports 30000 through 35000 in the security group for NodePort.

Update the script and chart values

This repository contains a few helper scripts to bootstrap monitoring in a cluster (create.sh and everything in the /scripts directory). Some values in these scripts need to be updated:

Grab the Kubernetes API URL for your EKS cluster using the following kubectl command.

> kubectl cluster-info
Kubernetes master is running at https://tickstackcluster.com
CoreDNS is running at https://tickstackcluster.com/api/v1/namespaces/kube-system/services/kube-dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Based on the Kubernetes platform being used, replace the value of cluster_name with your Kubernetes master URL, i.e. tickstackcluster.com in the output of kubectl cluster-info above, in the script located in the /scripts directory, e.g. scripts/aws-eks.sh, gcp.sh, openshift.sh, or oss-k8s.ash.

# Search for `cluster_name` in the script and replace the value 'api.tickstackcluster.com' with actual k8S cluster name or dns.
cluster_name="tickstackcluster.com"

In kapacitor/values.yaml, set the value of influxUrl to your cluster's master URL. Leave the port set to 30082.

# Search for `influxURL` in the yaml and replace the value 'api.tickstackcluster.com' with actual cluster Name.
influxURL: "http://tickstackcluster.com:30082"

In telegraf-ds/values.yaml, set the value of influxUrl to your cluster's master URL. Leave the port set to 30082.

# Search for `influxdb` in the yaml and Replace value of url 'api.tickstackcluster.com' with actual cluster Name.
- influxdb:
  url: "http://tickstackcluster.com:30082"

In telegraf-ds/values.yaml, set the value of prometheus to your cluster's master URL. Leave the ports set to 30080 and 30081.

# Search for `prometheus` in the yaml and Replace value 'api.tickstackcluster.com' at 2 places in urls with actual cluster Name.
- prometheus:
  urls: ["http://tickstackcluster.com:30080/metrics","http://tickstackcluster.com:30081/metrics"]

In telegraf-s/values.yaml, set the value of influxdb and kapacitor for your cluster's master URL. Leave the ports set to 30082 and 30083.

- influxdb:
  urls:
    - "http://tickstackcluster.com:30082"
- kapacitor:
  urls:
    - "http://tickstackcluster.com:30083"

There are some additional steps for depending on which flavor of Kubernetes you are using.

For OSS Kubernetes clusters

Have a daemon-set configuration on the master node of the cluster for telegraf-ds Execute following command on master node.

# Note: You need to ssh to master node to execute above command. Replace `ip-x-x-x-x` from `<ip-x-x-x-x.ec2.internal>` with cluster's master node private ip.
kubectl taint nodes <ip-x-x-x-x.ec2.internal> node-role.kubernetes.io/master:NoSchedule-

For OpenShift clusters

Warning! Deploying Helm charts to an OpenShift cluster can make the cluster less secure. Please read the latest documentation on using Helm with OpenShift before continuing.

Run following commands to add RBAC permissions.

oc adm policy add-cluster-role-to-user cluster-admin admin
oc adm policy add-scc-to-user hostaccess -z default
oc annotate namespace tick openshift.io/node-selector=""

Usage

After completing the steps above, run the create.sh script in the root of the repo.

./create.sh -s $service -a action -c $component
  - Options:
    -s service:  The name of the service.
             Valid options are `influxdb`, `kapacitor`, `telegraf-s`, `telegraf-ds`, `chronograf` and `all`
    -a action: Valid options are `create` and `destroy`
    -c component: Valid options are `oss-k8s`, `aws-eks`, `gcp`, `openshift` and `minikube`

Examples

To deploy all components with a single command:

./create.sh -s all -a create -c oss-k8s
./create.sh -s all -a destroy -c oss-k8s

To deploy a single TICK component:

./create.sh -s influxdb -a create -c oss-k8s
./create.sh -s influxdb -a destroy -c oss-k8s

Post-deployment

Once complete, the script will print endpoints for Chronograf and InfluxDB. Use the Chronograf endpoint URL to access the Chronograf dashboard. Use the Influxdb endpint URL to add a new InfluxDB connection. Replace the connection string with the InfluxDB endpoint URL.

About

Configuration to monitor Kubernetes with the TICK stack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 70.2%
  • Smarty 29.8%