Skip to content
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

feature: Support for remote cache #209

Closed
2 of 4 tasks
ArthurSens opened this issue Apr 4, 2023 · 13 comments
Closed
2 of 4 tasks

feature: Support for remote cache #209

ArthurSens opened this issue Apr 4, 2023 · 13 comments
Labels
enhancement New feature or request
Milestone

Comments

@ArthurSens
Copy link

Checklist:

  • I've searched for similar issues and couldn't find anything matching
  • I've discussed this feature in the #k8sgpt slack channel

Is this feature request related to a problem?

  • Yes
  • No

Describe the solution you'd like

It would be nice if k8sgpt had the option to cache remotely.

Benefits for the project and its users

With multiple individuals responsible for the same cluster/clusters, e.g. employees in the same company, a remote cache can decrease costs and latency if all those employees use the same cache.

Potential drawbacks

Additional context

@AlexsJones
Copy link
Member

I thought about this during implementation and agree in principal.
There are some considerations such as locking that cache during update which make it a little hard to coordinate from distributed clients, this is where a SaaS would be potentially quite useful.

Will think on it some more and add into the project backlog, thank you!

@AlexsJones AlexsJones added the enhancement New feature or request label Apr 4, 2023
@matthisholleville
Copy link
Contributor

I would like to propose a first implementation. Have you started something about this @AlexsJones ?

@AlexsJones
Copy link
Member

I haven't started anything, can you outline what you're thinking?

@matthisholleville
Copy link
Contributor

I think this issue needs to be split into two feature requests:

  • Adding a lock file (similar to Terraform state file) during analysis.
  • Adding remote storage functionality to store configuration files in S3 buckets, for example.

What do you think?

@AlexsJones
Copy link
Member

I think S3 can be set to do the locking for you?

@matthisholleville
Copy link
Contributor

Yes we could use this solution I think : https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html . But this solution does not work in the same way with all remote backends ( gcs, git, etc... ). Shouldn't we use a generic solution for all backends like terraform does ?

@ArthurSens
Copy link
Author

Looking at a User story, I believe Terraform and k8sgpt are used in different ways that might require different approaches here.

From my point of view at least, terraform is often used during CI for resource management and the lock makes sense because this really prevents a possible outage if not present.

Now pardon my lack of knowledge about k8sgpt internals, but what is the worst case possible if the cache doesn't have a lock during updates 😅? It shouldn't be able to actually make changes to a cluster, so although not the best UX, it is not able to cause outages right?

@matthisholleville
Copy link
Contributor

Thank you for your answer. It's a good question to ask. From my understanding we need a lock or mechanism to ensure that the cache is not corrupted when parallelizing the analyses.

@AlexsJones
Copy link
Member

I am doing some work on designing this, will update here when I have something we can discuss further.

@xavpaice
Copy link
Contributor

xavpaice commented May 3, 2023

Not sure if it's helpful, but you might want to see https://github.com/replicatedhq/troubleshoot, which has a support-bundle command that grabs a bunch of info from a running k8s cluster and pops it into a tarball, then https://github.com/replicatedhq/sbctl which has a utility capable of running a k8s api against that tarball. I tried it with k8sgpt just now and there's absolutely some gaps, we need to collect more info and fix some things in sbctl that explode when k8sgpt queries it, but that's do-able.

The short story is, you can grab a totally disconnected tarball from a cluster, ship it somewhere, and then serve it up and run kubectl commands against it without having to connect to the live cluster. Handy if you're doing disconnected support work. I'd love to get k8sgpt to read those bundles.

@AlexsJones
Copy link
Member

Not sure if it's helpful, but you might want to see https://github.com/replicatedhq/troubleshoot, which has a support-bundle command that grabs a bunch of info from a running k8s cluster and pops it into a tarball, then https://github.com/replicatedhq/sbctl which has a utility capable of running a k8s api against that tarball. I tried it with k8sgpt just now and there's absolutely some gaps, we need to collect more info and fix some things in sbctl that explode when k8sgpt queries it, but that's do-able.

The short story is, you can grab a totally disconnected tarball from a cluster, ship it somewhere, and then serve it up and run kubectl commands against it without having to connect to the live cluster. Handy if you're doing disconnected support work. I'd love to get k8sgpt to read those bundles.

I think the support bundle is an interesting idea, we do it in microk8s and it's really useful. I think there are two interesting requirements for this work

  • something that can be uploaded and shared
  • something that can represent enough of the cluster data to be useful for someone else running k8sgpt against it.

That second item I think is worthy of its own design discussion to take it further.

@AlexsJones AlexsJones added this to the v1.0.0 milestone May 12, 2023
@AlexsJones
Copy link
Member

Related to #381

@AlexsJones AlexsJones mentioned this issue May 18, 2023
4 tasks
@AlexsJones
Copy link
Member

Remove will be supported as of v0.3.3, thanks for the suggestion ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

4 participants