-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: Support multi-tenancy on object storage using custom prefix #1318
Comments
Design proposal to discussScope :
Expected result[Before] Current flat bucket file tree :
[After] Expected prefixed bucket file tree :
Implementation steps
type: S3
config:
prefix: "my/custom/prefix/"
bucket: ""
endpoint: ""
region: ""
access_key: ""
insecure: false
[...]
Forecats of impacted files :
|
The proposal LGTM 🥇 |
@edevouge is there any progress with this issue? |
@Nathan-Okolita-Aimtheory: a pull request ( #1392 ) implementing this feature is work-in-progress by @jaredallard |
I'm not against this per se, but we already have a multi-tenancy mechanism approved in the thanos receive component, that is label-set based. If we do something about multi-tenancy in the object store bucket, then that should be label-set based as well, as opposed to path based. |
@brancz would your label based implementation look like this in the Bucket.yml: |
A tenant is a label-set, so not just a single label. So that specific part would rather be something like:
|
@brancz I'm not fully familiar with the label based tenants, but segregating in the bucket path allows you to use one bucket & policies for multiple Thanos deployments, that may not want to share Thanos services. At least in my case, I have different teams with different products. By leveraging path restrictions I can reduce my S3 bucket sprawl. It also means that teams that may want to share a common query endpoint can do so, without exposing themselves to cardinality bombs by bad deployments. If someone does something bad, it only impacts their bucket location. @edevouge @jaredallard are either of you continuing to work on the existing PR? |
These changes would allow lifecycle management inside the multipurpose buckets. |
We host all monitoring related configs, backup etc. under single bucket and would like to use that bucket to host thanos data as well. This feature would be super useful. |
Elimination of multiple buckets maintenance is definitive adventage. I played a little bit with PR from @Dlag (PR mentioned above) and menaged to setup configuration with read and write access, however I spotted that compaction is affected when accessing data from s3 subdirectories, failing with |
This issue/PR has been automatically marked as stale because it has not had recent activity. Please comment on status otherwise the issue will be closed in a week. Thank you for your contributions. |
Kind of the same use case here where I need to set a prefix because Thanos data will not be the only data I would stored in the bucket. Seems like two PRs have been closed for this issue but I'm having hard time to understand what the blocker is. How can we move forward here ? :) |
This issue/PR has been automatically marked as stale because it has not had recent activity. Please comment on status otherwise the issue will be closed in a week. Thank you for your contributions. |
I am still hoping this issue will be picked up. We have an environment with many Prometheus instances many of which are deployed through automation. Having to provision many s3 buckets is not a very appealing prospect. |
This issue/PR has been automatically marked as stale because it has not had recent activity. Please comment on status otherwise the issue will be closed in a week. Thank you for your contributions. |
I think there is still a lot of interest here. This would make it a lot easier to operate a single Thanos that can aggregate metrics for N teams' prometheuses. |
Introducing the ability to configure an optional bucket prefix would also be a nice step forward towards Cortex blocks storage and Thanos bucket store interoperability. |
Thanks for the explanations @markmsmith @roidelapluie @dsayan154 I think I am happy with some simple prefix to make sure you can store blocks deeper in bucket (or have it compatible with Cortex).
You just point multiple sidecars to the same bucket, same directory. Since Prometheus has unique external labels we can distinguish between blocks. Directory does not matter for Thanos. (:
I think both things are the same right? Multiple metric sources (e.g Prometheus + sidecar) from multiple potentially isolated teams, uploading to the same bucket, thus allowing whatever set of compactors/store gateways thanks to sharding.
Deletion of data for a defined prefix is a valid issue/ request you can put on Thanos and we can guide/help you write reliable CLI / tooling to make it work. (complexity no 1) (: You can even build on top of that and automated this purely with some deletion API tenant. Building on top of prefix is really not just hacking prefixes for multitenancy. Our semantics for multitenancy is around labels, so would be nice if your setup will follow the same rules so we can work together on those complexities you mentioned (: Per complexity number 2. You are right this is some scalability limitation, however further away (you can have easily 100k items for iter API and it's quite large number of blocks (something like 1y of ~100 tenants) for Thanos with healthy compaction). This is however easy to solve by copying the blocks new dirs if needed etc. Let's create an issue to discuss potential solutions. What I am saying is that
YES! cc @Oghenebrume50 @prmsrswt @kunal-kushwaha for motivation to get block viewer natively for Prometheus (and Complex a well!) |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Still valid |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Still valid? |
What is the current status of this? :) |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
still valid |
Why won't you do it dynamic rather than config based? |
Hello 👋 Looks like there was no activity on this issue for the last two months. |
Still needed. |
Hi @bwplotka
This will put a huge and unnecessary pressure on each thanos store process, as well as the singleton compactor process. For instance, say now I create a new cluster with a new thanos deployment in it, pointing to an existing bucket where other existing old clusters are using as metrics storage backend, the thanos store will immediately require a huge amount of resources (disk, CPU, memory) to process all the existing metrics data in that bucket, even when the new cluster hasn't even started generating a single data point. This problem is more obvious on the compactor component since it is required to be a singleton process. Losing this one single process means losing data compaction globally, which is a huge risk. Our current mitigation is just to create one bucket for each "tenant" (Kubernetes cluster) so each one can mind their own resource requirements for thanos store and compactor. But this means a lot of buckets. |
Any update on this? Is it at all planned to be added at some point of time? @bwplotka |
Hi, all again! Thanks all for keeping this up to date - it's really important to solve all the important cases you might have. Please let us know if this is still valid and for what reasons--we never said no to this, but honestly, we still don't see a clear need. Let me explain: Currently, all Thanos components support multi-tenancy thanks to external labels:
The only need for this kind implementation might be useful when we hit limit of number of directories to scan in single bucket, Prefix might in theory help here for scan speed up. But these reasons seem to be very different to what we see from responses here and might have different solutions (e.g having 2 buckets etc.) @roidelapluie mentioned
If I understand it right the Let us know if we miss anything here 🤗 Thanks! |
Thanks your detailed note. I think the solutions like having 2 or more buckets need a heavy resource operatation . when create a new tenant , using bucket prefix is more easily than apply create a bucket. |
The reason bucket prefix support is appealing to us and probably others, is since we use silo multi-tenancy model for our tenants, meaning that each tenant's bucket must not be accessible to another tenant. |
The use case I posted in May of 2020 is still relevant today, and the lack of this feature blocks us from reducing the number of buckets we need to spin up for each tenant within an AWS account: |
Closed by #5337. |
Support multi-tenancy on object storage using custom prefix
Context / Use case
On a multi-cluster kubernetes setup with multiple prometheus instances (one per namespace) using PrometheusOperator. Each prometheus instance embed its own thanos sidecar and for performance & scalability purpose data chuncks are sharded accross multiple s3 buckets.
For each prometheus instance, there is a dedicated thanos store and a thanos compactor working on its own bucket. One thanos query is setup to map/reduce promql queries across multiple stores and thanos-sidecars.
Problems
Question / feature request
Is there a way to share a bucket across multiple thanos instances (keeping the sharding property) ?
Otherwise, a cool feature could be the ability to add a custom prefix on thanos objects (objstore.config). So we could take advantage of s3 bucket multi-tenancy.
s3://<my-bucket-name>/**<custom-prefix>**/<thanos-objects>
The text was updated successfully, but these errors were encountered: