欧洲杯投注软件

Monitoring Setup Made Simple with Tanka and the Prometheus-Ksonnet Library

Published: 10 Feb 2020 by Malcolm Holmes RSS

As mentioned in a previous post, at Grafana Labs we make heavy use of and the Jsonnet programming language to manage our Kubernetes infrastructure.

One of the benefits of the use of Jsonnet is the depth of collaboration that it allows with others outside of your company.

For example, the open source can be used to install both Prometheus and Grafana. While it’s at it, it also installs the library, which adds a set of best practice dashboards and alerts for monitoring Kubernetes resources. It also makes it easy to add Prometheus configuration and Grafana dashboards specific to your application.

To see how this can be used to programmatically create dashboards, see .

In this post, we will explain the steps needed to get prometheus-ksonnet working.

Notes Before You Get Started

We start with the assumption that you have a running Kubernetes cluster and have kubectl installed, and that it is correctly connected and authenticated with your cluster. Below you will need to provide the name of a KubeConfig context into which you can install resources.

If you do not have a cluster available, you could try , which runs a complete (but cut down) Kubernetes cluster within Docker. Once k3d is installed, use this to start a cluster:

k3d create --name tanka-demo
export KUBECONFIG="$(k3d get-kubeconfig --name tanka-demo)"

After this, use tanka-demo as your KubeConfig context in the following steps.

Step-by-Step Instructions

First, download and install . Tanka allows us to interact with Kubernetes.

Then download and install . This allows us to download “bundles” of jsonnet that have been shared via Git/GitHub.

To install prometheus-ksonnet, use these commands, replacing <my-kubernetes-context> with the one you selected above:

mkdir tanka
cd tanka
tk init
tk env set environments/default --server-from-context <my-kubernetes-context>
jb install http://github.com/grafana/jsonnet-libs/prometheus-ksonnet

Next, edit the file environments/default/main.jsonnet and replace what’s there with this content:

local prometheus = import 'prometheus-ksonnet/prometheus-ksonnet.libsonnet';

prometheus {
  _config+:: {
    namespace: "default",
    cluster_name: "grafana",
  },
}

Then, run: tk apply environments/default

And watch your Grafana/Prometheus/NodeExporter/Dashboards arrive in your cluster (e.g. by using kubectl get pods).

欧洲杯投注软件Once the pods are running, you can access these services with this command:

```
kubectl port-forward deploy/nginx 8080:80
```

欧洲杯投注软件Then visit . You will see a simple page that gives links to both your local Grafana, and your local Prometheus instances.

For More Information

欧洲杯投注软件For a demonstration of Grafana and the dashboards that this creates, cohosted by Grafana Labs and Oracle.

欧洲杯投注软件Try it out and let us know what you think. And stay tuned for a followup blog post about how you can use this installation to push metrics to Grafana Cloud.

Related Posts

YAML sucks! This blog post explains why existing tools hardly ease this pain, and what we at Grafana Labs did about it.
Grafana Labs returns to KubeCon + CloudNativeCon starting today -- here’s where you can meet the team in San Diego this week.
KubeCon + CloudNativeCon returns to North America next month. Here’s where you will find Grafana Labs team members during the conference.

Related Case Studies

DigitalOcean gains new insight with Grafana visualizations

The company relies on Grafana to be the consolidated data visualization and dashboard solution for sharing data.

"Grafana produces beautiful graphs we can send to our customers, works with our Chef deployment process, and is all hosted in-house."
– David Byrd, Product Manager, DigitalOcean

How Grafana Cloud is enabling HotSchedules to develop next-generation applications

The visibility for all these metrics helps service delivery teams quickly iterate on new features.

"Grafana Cloud enables us to achieve observability bliss at HotSchedules. We don’t have to worry about scaling and maintaining the service."
– Denise Stockman, Director, Infrastructure, Hotschedules

How Grafana Cloud is enabling Packet’s teams, from engineering to sales

欧洲杯投注软件Most people at Packet look at a Grafana dashboard at some point during their work day.

"Being able to, in a single dashboard, pull in data from a variety of different data sources provides the biggest value for us."
– Nathan Goulding, SVP, Engineering, Packet