Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.2 KB

README.md

File metadata and controls

77 lines (53 loc) · 2.2 KB

Jsonnet for Cortex on Kubernetes

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


NOTE

If you are more familiar with helm you should use the helm chart for cortex


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 install github.com/grafana/tanka/cmd/[email protected]
    $ GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
  2. Initialise the Tanka repo, install the Cortex and Kubernetes Jsonnet libraries.

    $ mkdir <name> && cd <name>
    $ tk init --k8s=1.26 # this includes github.com/jsonnet-libs/k8s-libsonnet/1.26@main
    $ jb install github.com/cortexproject/cortex-jsonnet/cortex@main
  3. Use any of the examples to get a main.jsonnet and adjust as needed

    $ cp vendor/cortex/azure/main.jsonnet.example environments/default/main.jsonnet
    $ cp vendor/cortex/gcs/main.jsonnet.example environments/default/main.jsonnet
    $ cp vendor/cortex/s3/main.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 install github.com/monitoring-mixins/mixtool/cmd/mixtool@2ff523ea63d1cdeee2a10e01d1d48d20adcc7030
$ GO111MODULE=on go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
$ git clone https://github.com/cortexproject/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).