To install the Thanos operator on a single cluster, complete the following steps.
Prerequisites 🔗︎
- Thanos operator requires Kubernetes v1.14.x or later.
- For the Helm based installation you need Helm v3.0.2 or later.
-
Create the
monitor
namespace where the Thanos operator and other components will be deployed.CAUTION:
Prometheus operator and Thanos must be deployed into the same namespace.kubectl create namespace monitor
-
(Optional) If you want to store your metrics in an object store, complete the following steps.
-
Create an 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
-
Deploy the secret on Kubernetes
kubectl create secret generic thanos --from-file=object-store.yaml=object-store.yaml --namespace monitor
-
Create the Thanos sidecar definition. Remember to set
externalLabels
as it identifies the Prometheus instance for Thanos.Extra configuration for prometheus operator.
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
-
Install the Thanos operator using Helm, the One Eye CLI, or from manifests.
Install the Thanos operator with Helm 🔗︎
To install the Thanos operator with Helm 3, complete the following steps. Alternatively, you can install the Thanos operator with the One Eye CLI.
-
Add the Prometheus operator Helm repository.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update
-
Install the Prometheus operator. If you want to use object storage to store your metrics, include the configuration of the Thanos sidecar.
helm install prometheus-operator --namespace monitor prometheus-community/kube-prometheus-stack -f thanos-sidecar.yaml
-
Add the Thanos operator chart repository.
helm repo add banzaicloud-stable https://kubernetes-charts.banzaicloud.com helm repo update
-
Install the Thanos operator.
helm install thanos-operator --namespace monitor banzaicloud-stable/thanos-operator
Validate Thanos operator deployment 🔗︎
To verify that the installation was successful, complete the following steps.
-
Check the status of the pods. You should see a new thanos-operator pod.
$ kubectl -n monitor get pods NAME READY STATUS RESTARTS AGE thanos-operator-7df8485bf6-gf5gk 1/1 Running 0 13s
-
Check the CRDs. You should see the following three new CRDs.
$ kubectl get crd NAME CREATED AT objectstores.monitoring.banzaicloud.io 2020-02-07T21:48:20Z storeendpoints.monitoring.banzaicloud.io 2020-02-07T21:48:20Z thanos.monitoring.banzaicloud.io 2020-02-07T21:48:20Z
-
Verify the installation by opening the Thanos query page.
one-eye thanos connect