Skip to content

This repo has the jsonnet for deploying and also the mixin for monitoring Cortex

License

Notifications You must be signed in to change notification settings

mintel/cortex-jsonnet

 
 

Repository files navigation

Jsonnet for Cortex on Kubernetes

This repo has the jsonnet for deploying Cortex and the related monitoring in Kubernetes.

To generate the YAMLs for deploying Cortex:

  1. Make sure you have tanka and jb installed:

    Follow the steps at https://tanka.dev/install. If you have go installed locally you can also use:

    $ # make sure to be outside of GOPATH or a go.mod project
    $ GO111MODULE=on go get github.com/grafana/tanka/cmd/tk
    $ GO111MODULE=on go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
  2. Initialise the Tanka, and install the Cortex and Kubernetes Jsonnet libraries.

    $ mkdir <name> && cd <name>
    $ tk init --k8s=false
    $ # The k8s-alpha library supports Kubernetes versions 1.14+
    $ jb install github.com/jsonnet-libs/k8s-alpha/1.18
    $ cat <<EOF > lib/k.libsonnet
      (import "github.com/jsonnet-libs/k8s-alpha/1.18/main.libsonnet")
      + (import "github.com/jsonnet-libs/k8s-alpha/1.18/extensions/kausal-shim.libsonnet")
      EOF
    $ jb install github.com/grafana/cortex-jsonnet/cortex@main
  3. Use the example monitoring.jsonnet.example:

    $ cp vendor/cortex/cortex-manifests.jsonnet.example environments/default/main.jsonnet
  4. Check what is in the example:

    $ cat environments/default/main.jsonnet
    ...
  5. Generate the YAML manifests:

    $ tk show environments/default

    To output YAML manifests to ./manifests, run:

    $ tk export manifests environments/default

Monitoring for Cortex

To generate the Grafana dashboards and Prometheus alerts for Cortex:

$ GO111MODULE=on go get github.com/monitoring-mixins/mixtool/cmd/mixtool
$ GO111MODULE=on go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
$ git clone https://github.com/grafana/cortex-jsonnet
$ cd cortex-jsonnet
$ make build-mixin

This will leave all the alerts and dashboards in cortex-mixin/cortex-mixin.zip (or cortex-mixin/out).

If you get an error like cannot use cli.StringSliceFlag literal (type cli.StringSliceFlag) as type cli.Flag in slice literal when installing mixtool, make sure you set GO111MODULE=on before go get.

About

This repo has the jsonnet for deploying and also the mixin for monitoring Cortex

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jsonnet 98.3%
  • Other 1.7%