Skip to content

Latest commit

 

History

History
95 lines (73 loc) · 2.55 KB

single_cluster_thanos.md

File metadata and controls

95 lines (73 loc) · 2.55 KB

Single Cluster Thanos Install

Prerequisites for Thanos

  1. Create monitor namespace

    kubectl create namespace monitor
  2. Create Object Store secret

    Example S3 configuration

    cat <<'EOF' >> object-store.yaml
    type: S3
    config:
      endpoint: "s3.eu-west-1.amazonaws.com"
      bucket: "test-bucket"
      region: "eu-west-1"
      access_key: "XXXXXXXXX"
      secret_key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    EOF
    
  3. Deploy the secret on Kubernetes

    kubectl create secret generic thanos --from-file=object-store.yaml=object-store.yaml --namespace monitor
    
  4. Create the Thanos sidecar definition Extra configuration for prometheus operator.

    Note: Prometheus-operator and Thanos MUST be in the same namespace.

    cat <<'EOF' >> thanos-sidecar.yaml
    prometheus:
      prometheusSpec:
        thanos:
          image: quay.io/thanos/thanos:v0.17.2
          version: v0.17.2
          objectStorageConfig:
            name: thanos
            key: object-store.yaml
        externalLabels: 
          cluster: thanos-operator-test
    EOF
    

    Remember to set externalLabels as it identifies the Prometheus instance for Thanos.

Install the Thanos Operator with Helm

  1. Add the Kubernetes stable Helm repository

    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    helm repo update
    
  2. Install prometheus-operator with the Thanos sidecar

    helm install prometheus-operator --namespace monitor prometheus-community/kube-prometheus-stack -f thanos-sidecar.yaml
    
  3. Add the operator chart repository.

    helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com
    helm repo update
  4. Install the Thanos Operator

    helm install thanos-operator --namespace monitor banzaicloud-stable/thanos-operator

Install the Thanos Operator with the One Eye CLI

One Eye will take care of installing and configuring all the dependencies.

install the One Eye CLI and deploy the Thanos operator

curl https://getoneeye.sh | sh && one-eye thanos install --prometheus --secret one-eye/object-store.yaml

verify the installation by opening the thanos query page

  one-eye thanos connect