Bitnami提供的Thanos Helm chart,用于简化在Kubernetes环境中部署Thanos,实现Prometheus监控数据的高可用和长期存储。
Bitnami Secure Images Helm chart for Thanos
Thanos is a highly available metrics system that can be added on top of existing Prometheus deployments, providing a global query view across all Prometheus installations.
https://thanos.io/
Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement.
TL;DR
consolehelm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/thanos
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository.
Introduction
This chart bootstraps a https://github.com/bitnami/containers/tree/main/bitnami/thanos deployment on a https://kubernetes.io cluster using the https://helm.sh package manager.
Before you begin
- Kubernetes 1.23+
- Helm 3.8.0+
- PV provisioner support in the underlying infrastructure
Installing the Chart
To install the chart with the release name my-release:
consolehelm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/thanos
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to useREGISTRY_NAME=registry-1.docker.ioandREPOSITORY_NAME=bitnamicharts.
These commands deploy Thanos on the Kubernetes cluster with the default configuration. The configuration section lists the parameters that can be configured during installation.
Tip: List all releases using
helm list
Architecture
This charts allows you install several Thanos components, so you deploy an architecture as the one below:
text+--------------+ +--------------+ +--------------+ | Thanos |----------------> | Thanos Store | | Thanos | | Query | | | Gateway | | Compactor | +--------------+ | +--------------+ +--------------+ push | | | +--------------+ alerts +--------------+ | | storages | Downsample & | Alertmanager | <----------| Thanos | <----| | query metrics | compact blocks | (*) | | Ruler | | | | +--------------+ +--------------+ | \/ | ^ | | +----------------+ | | push alerts +--------------|----> | MinIO® (*) | <---------+ | | | | +------------------------------+ | +----------------+ |+------------+ +------------+| | ^ || Prometheus |->| Thanos || <----------------+ | || (*) |<-| Sidecar (*)|| query | inspect |+------------+ +------------+| metrics | blocks +------------------------------+ | +--------------+ | Thanos | | Bucket Web | +--------------+
Note: Components marked with (*) are provided by subchart(s) (such as the https://github.com/bitnami/charts/tree/main/bitnami/minio) or external charts (such as the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus).
Check the section Integrate Thanos with Prometheus and Alertmanager for detailed instructions to deploy this architecture.
Configuration and installation details
This section describes credentials, configuration, and other installation options.
Resource requests and limits
Bitnami charts allow setting resource requests and limits for all containers inside the chart deployment. These are inside the resources value (check parameter table). Setting requests is essential for production workloads and these should be adapted to your specific use case.
To make this process easier, the chart contains the resourcesPreset values, which automatically sets the resources section according to different presets. Check these presets in https://github.com/bitnami/charts/blob/main/bitnami/common/templates/_resources.tpl#L15. However, in production workloads using resourcesPreset is discouraged as it may not fully adapt to your specific needs. Find more information on container resource management in the https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/.
Prometheus metrics
This chart can be integrated with Prometheus by setting metrics.enabled to true. This will expose Thanos native Prometheus endpoint in the service. It will have the necessary annotations to be automatically scraped by Prometheus.
Prometheus requirements
It is necessary to have a working installation of Prometheus or Prometheus Operator for the integration to work. Install the https://github.com/bitnami/charts/tree/main/bitnami/prometheus or the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus to easily have a working Prometheus in your cluster.
Integration with Prometheus Operator
The chart can deploy ServiceMonitor objects for integration with Prometheus Operator installations. To do so, set the value metrics.serviceMonitor.enabled=true. Ensure that the Prometheus Operator CustomResourceDefinitions are installed in the cluster or it will fail with the following error:
textno matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"
Install the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus for having the necessary CRDs and the Prometheus Operator.
Gateway API
This chart provides support for exposing Thanos using the https://gateway-api.sigs.k8s.io/ and its HTTPRoute resource. If you have a Gateway controller installed on your cluster, such as APISIX, Contour, Envoy Gateway, NGINX Gateway Fabric or Kong Ingress Controller you can utilize the Gateway controller to serve your application. To enable Gateway API integration, set XXX.httpRoute.enabled to true (where XXX is bucketweb, compactor, query, queryFrontend, receive, ruler or storegateway depending on which component you want to expose).
The Gateway to be used can be customized by setting the XXX.httpRoute.parentRefs parameter. By default, it will reference a Gateway named gateway in the same namespace as the release.
You can specify the list of hostnames to be mapped to the deployment using the XXX.httpRoute.hostnames parameter. Additionally, you can customize the rules used to route the traffic to the service by modifying the XXX.httpRoute.matches and XXX.httpRoute.filters parameters or adding new rules using the XXX.httpRoute.extraRules parameter.
Securing traffic using TLS
Thanos can encrypt communications by setting *.tls.enabled=true (under the query.grpc.client, query.grpc.server, storegateway.grpc.server and receive.grpc.server sections) value. The chart allows three configuration options:
- Provide the content of the certificates using the
*.tls.ca,*.tls.cert,*.tls.key(under thequery.grpc.client,query.grpc.server,storegateway.grpc.serverandreceive.grpc.serversections) values. - Provide your own secrets using the
*.tls.existingSecret(under thequery.grpc.client,query.grpc.server,storegateway.grpc.serverandreceive.grpc.serversections) values. Apart from providing the secret name also set a key mapping to theca-cert,tls-certandtls-keyelements. For example:
yamlreceive: grpc: server: tls: existingSecret: name: foo keyMapping: ca-cert: ca.pem tls-cert: cert.pem tls-key: key.pem
- Have the chart auto-generate the certificates using
*.tls.autoGenerated=true(under thequery.grpc.client,query.grpc.server,storegateway.grpc.serverandreceive.grpc.serversections).
https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/apps-tutorials-understand-rolling-tags-containers-index.html
It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image.
Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist.
Adding extra flags
In case you want to add extra flags to any Thanos component, you can use XXX.extraFlags parameter(s), where XXX is placeholder you need to replace with the actual component(s). For instance, to add extra flags to Thanos Store Gateway, use:
yamlstoregateway: extraFlags: - --sync-block-duration=3m - --chunk-pool-size=2GB
This also works for multi-line flags. This can be useful when you want to configure caching for a particular component without using a configMap. For example, to configure the https://thanos.io/tip/components/query-frontend.md/#memcached, use:
yamlqueryFrontend: extraFlags: - | --query-range.response-cache-config= type: MEMCACHED config: addresses: - <MEMCACHED_SERVER>:11211 timeout: 500ms max_idle_connections: 100 max_async_concurrency: 10 max_async_buffer_size: 10000 max_get_multi_concurrency: 100 max_get_multi_batch_size: 0 dns_provider_update_interval: 10s expiration: 24h
Using custom Objstore configuration
This helm chart supports using custom Objstore configuration.
You can specify the Objstore configuration using the objstoreConfig parameter.
In addition, you can also set an external Secret with the configuration file. This is done by setting the existingObjstoreSecret parameter. Note that this will override the previous option. If needed you can also provide a custom Secret Key with existingObjstoreSecretItems, please be aware that the Path of your Secret should be objstore.yml.
Using custom Query Service Discovery configuration
This helm chart supports using custom Service Discovery configuration for Query.
You can specify the Service Discovery configuration using the query.sdConfig parameter.
In addition, you can also set an external ConfigMap with the Service Discovery configuration file. This is done by setting the query.existingSDConfigmap parameter. Note that this will override the previous option.
Using custom Ruler configuration
This helm chart supports using custom Ruler configuration.
You can specify the Ruler configuration using the ruler.config parameter.
In addition, you can also set an external ConfigMap with the configuration file. This is done by setting the ruler.existingConfigmap parameter. Note that this will override the previous option.
Running Thanos with HTTPS and basic authentication
This helm charts supports using HTTPS and basic authentication. The underlying feature is experimental and might change in the future, so are the associated settings in the chart. For more information, please refer to https://thanos.io/tip/operating/https.md/#running-thanos-with-https-and-basic-authentication.
This feature can be enabled by using the following values:
-
https.enabled=true. Enabling HTTPS requires the user to provide the TLS certificate and Key for Thanos, which can be done using one of the following options:- Provide a secret using
https.existingSecret. The secret must contain the keystls.crtortls.key(key names can be renamed using the valueshttps.keyFilenameandhttps.certFilename). - Provide the certificate and key in your values.yaml under the values
https.certandhttps.key. - Use
https.autoGenerated=true, using this value Helm will generate a self-signed key pair during the chart initialization. Not recommended for production environments.
- Provide a secret using
-
auth.basicAuthUsers.*. An dictionary of key / values, where the keys corresponds to the users that will have access to Thanos and the values are the plaintext passwords. Passwords will be later encrypted with bcrypt. -
Alternatively, provide your own Thanos http config file using the value
httpConfigorexistingHttpConfigSecret. This may cause any settings underhttps.*orauth.*to be ignored, except for the settings related to the TLS certificates. When providing a configuration file using these parameters, the chart Probes will fail to initialize unless one of the following fixes are applied:- Set
https.enabledorauth.basicAuthUserswith at least one user, matching the configuration file you provided. That way Probes will be configured with HTTPS and/or basic authentication accordingly. - Configure your own Probes using
<component>.customLivenessProbe,<component>.customReadinessProbeand<component>.customStartupProbe. - Not recommended. Disable the Probes.
- Set
Store time partitions
Thanos store supports partition based on time.
Setting time partitions will create N number of store statefulsets based on the number of items in the timePartitioning list. Each item must contain the min and max time for querying in the supported format (find more details at https://thanos.io/tip/components/store.md/#time-based-partitioning).
Note: leaving the
timePartitioninglist empty ([]) will create a single store for all data.
For instance, to use 3 stores you can use a values.yaml like the one below:
yamltimePartitioning: # One store for data older than 6 weeks - min: "" max: -6w # One store for data newer than 6 weeks and older than 2 weeks - min: -6w max: -2w # One store for data newer than 2 weeks - min: -2w max: ""
You can also specify different resources and limits configurations for each storegateway statefulset. This is done by adding a resources.requests and resources.limits to each item you wish to change, as shown below:
yamltimePartitioning: # One store for data older than 6 weeks - min: "" max: -6w # One store for data newer than 6 weeks and older than 2 weeks - min: -6w max: -2w resources: #optional resources declaration for partition requests: cpu: 10m memory: 100Mi limits: cpu: 20m memory: 100Mi # One store for data newer than 2 weeks - min: -2w max: ""
Integrate Thanos with Prometheus and Alertmanager
You can integrate Thanos with Prometheus & Alertmanager using this chart and the https://github.com/bitnami/charts/tree/main/bitnami/kube-prometheus following the steps below:
Note: in this example we will use MinIO® (subchart) as the Objstore. Every component will be deployed in the "monitoring" namespace.
- Create a values.yaml like the one below:
yamlobjstoreConfig: |- type: s3 config: bucket: thanos endpoint: {{ include "thanos.minio.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:9000 access_key: minio secret_key: minio123 insecure: true query: dnsDiscovery: sidecarsService: kube-prometheus-prometheus-thanos sidecarsNamespace: monitoring bucketweb: enabled: true compactor: enabled: true storegateway: enabled: true ruler: enabled: true alertmanagers: - http://kube-prometheus-alertmanager.monitoring.svc.cluster.local:9093 config: |- groups: - name: "metamonitoring" rules: - alert: "PrometheusDown" expr: absent(up{prometheus="monitoring/kube-prometheus"}) metrics: enabled: true serviceMonitor: enabled: true minio: enabled: true auth: rootPassword: minio123 rootUser: minio monitoringBuckets: thanos accessKey: password: minio secretKey: password: minio123
- Install Prometheus Operator and Thanos charts:
For Helm 3:
console$ kubectl create namespace monitoring helm install kube-prometheus \ --set prometheus.thanos.create=true \ --namespace monitoring \ bitnami/kube-prometheus helm install thanos \ --values values.yaml \ --namespace monitoring \ oci://REGISTRY_NAME/REPOSITORY_NAME/thanos
Note: You need to substitute the placeholders
REGISTRY_NAMEandREPOSITORY_NAMEwith a reference to your Helm chart registry and repository. For example, in the case of Bitnami, you need to useREGISTRY_NAME=registry-1.docker.ioandREPOSITORY_NAME=bitnamicharts.
That's all! Now you have Thanos fully integrated with Prometheus and Alertmanager.
Deploy extra resources
There are cases where you may want to deploy extra objects, such a ConfigMap containing your app's configuration or some extra deployment with a micro service used by your app. For covering this case, the chart allows adding the full specification of other objects using the extraDeploy parameter.
Setting Pod's affinity
This chart allows you to set your custom affinity using the XXX.affinity parameter(s). Find more information about Pod's affinity in the https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity.
As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the https://github.com/bitnami/charts/tree/main/bitnami/common#affinities chart. To do so, set the XXX.podAffinityPreset, XXX.podAntiAffinityPreset, or XXX.nodeAffinityPreset parameters.
Backup and restore
To back up and restore Helm chart deployments on Kubernetes, you need to back up the persistent volumes from the source deployment and attach them to a new deployment using https://velero.io/, a Kubernetes backup/restore tool. Find the instructions for using Velero in https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/apps-tutorials-backup-restore-deployments-velero-index.html.
FIPS parameters
The FIPS parameters only have effect if you are using images from the https://go-vmware.broadcom.com/contact-us.
For more information on this new support, please refer to the https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-doc/security-frameworks-FIPS-compliance.html.
Persistence
The data is persisted by default using PVC(s) on Thanos components. You can disable the persistence setting the XXX.persistence.enabled parameter(s) to false. A default StorageClass is needed in the Kubernetes cluster to dynamically provision the volumes. Specify another StorageClass in the XXX.persistence.storageClass parameter(s) or set XXX.persistence.existingClaim if you have already existing persistent volumes to use.
Note: you need to substitute the XXX placeholders above with the actual component(s) you want to configure.
Adjust permissions of persistent volume mountpoint
As the images run as non-root by default, it is necessary to adjust the ownership of the persistent volumes so that the containers can write data into it.
By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volumes. However, this feature does not work in all Kubernetes distributions. As an alternative, this chart supports using an initContainer to change the ownership of the volumes before mounting it in the final destination.
You can enable this initContainer by setting volumePermissions.enabled to true.
Parameters
The following subsections list global, common, and component-specific parameters.
Global parameters
| Name | Description | Value |
|---|---|---|
global.imageRegistry | Global Docker image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
global.defaultStorageClass | Global default StorageClass for Persistent Volume(s) | "" |
global.defaultFips | Default value for the FIPS configuration (allowed values: '', restricted, relaxed, off). Can be overridden by the 'fips' object | restricted |
global.security.allowInsecureImages | Allows skipping image verification |
Note: the README for this chart is longer than the DockerHub length limit of 25000, so it has been trimmed. The full README can be found at https://techdocs.broadcom.com/us/en/vmware-tanzu/bitnami-secure-images/bitnami-secure-images/services/bsi-app-doc/apps-charts-thanos-index.html
bitnamicharts 命名空间的其他可用镜像:
bitnamicharts/mysql
bitnamicharts/kafka
bitnamicharts/etcd
bitnamicharts/postgresql
bitnamicharts/harbor
bitnamicharts/milvus
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
轩辕镜像加速拉取命令点我查看更多 thanos 镜像标签
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务