janwillies / cortex-cue

configuration manifests to deploy a minimal cortex setup to Kubernetes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cortex manifests for kubernetes

this repo hosts the configuration manifests to deploy a minimal cortex setup to kubernetes.

it is based on the single-process cortex config and configured to have minio as a backend store

setup

create a kubernetes cluster if you haven't

kind create cluster

service installation

install cortex and minio to the kubernetes cluster:

kubectl apply -f generated.yaml

this will also launch a pod to create a respective bucket in minio.

test the setup

port-forward the cortex api:

kubectl port-forward deployment/cortex 9009

create an example rule group:

curl --location 'http://localhost:9009/api/v1/rules/ns1' \
--header 'Content-Type: application/yaml' \
--header 'X-Scope-OrgID: f00bar' \
--data 'name: rule1
rules:
  - record: instance_path:request_failures:rate5m
    expr: rate(request_failures_total{job="myjob"}[5m])
  - alert: HighCPUUtilization
    expr: avg(node_cpu{mode="system"}) > 80
    for: 5m
    annotations:
      annotation_name: test
    labels:
      label_name: test'

{"status":"success","data":null,"errorType":"","error":""}

addendum

generate yaml

cue dump ./... > generated.yaml

single manifests per service

cue export --out yaml -e service.minio -e deployment.minio ./minio | kubectl apply -f -
cue export --out yaml -e configMap.cortex -e deployment.cortex ./cortex | kubectl apply -f -

prepare object store manually

port-forward the minio api:

kubectl port-forward deployment/minio 9000

download the minio client (mc) and create the cortex bucket:

./mc alias set local http://localhost:9000 minioadmin minioadmin
./mc mb local/cortex
./mc tree local/

About

configuration manifests to deploy a minimal cortex setup to Kubernetes


Languages

Language:CUE 100.0%