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

Ensure discovery cache can be written by client-go in the kubeappsapis service #6128

Merged
merged 1 commit into from Mar 23, 2023

Conversation

absoludity
Copy link
Contributor

Description of the change

Gives permission for the running process to write the k8s discovery cache when kubeapps-apis first communicates with the k8s api server.

This doesn't appear to affect users, but may be contributing to memory usage and potentially restarts.

Before this change, after deploying an app, the following would appear in the kubeapps-apis logs:

I0322 23:20:57.965475       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/batch/v1/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965483       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/autoscaling/v2/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965485       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/apiregistration.k8s.io/v1/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965495       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/batch/v1beta1/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965501       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/node.k8s.io/v1/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965505       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/autoscaling/v1/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965505       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/coordination.k8s.io/v1/serverresources.json due to mkdir /.kube: permission denied
I0322 23:20:57.965513       1 cached_discovery.go:93] failed to write cache to /.kube/cache/discovery/10.96.0.1_443/events.k8s.io/v1beta1/serverresources.json due to mkdir /.kube: permission denied

The client appears to work fine without a cache, but will be doing unnecessary work with each deploy (and we did in the past investigate an issue where memory was being consumed on each deploy resulting in kubeapps-apis restarts).

With this change, the above errors are no longer seen, and the cache can be verified with:

k -n kubeapps exec kubeapps-internal-kubeappsapis-545486f55f-8zj9h -- ls -al /.kube/cache/
total 20
drwxr-xr-x 1 1001 1001 4096 Mar 23 00:09 .
drwxr-xr-x 1 root root 4096 Mar 23 00:02 ..
drwxr-x--- 3 1001 root 4096 Mar 23 00:09 discovery
drwxr-x--- 3 1001 root 4096 Mar 23 00:10 http

Benefits

Better resource usage and possibly less memory and restarts in some environments.

Possible drawbacks

Applicable issues

  • fixes #

Additional information

service.

Signed-off-by: Michael Nelson <minelson@vmware.com>
@netlify
Copy link

netlify bot commented Mar 23, 2023

Deploy Preview for kubeapps-dev canceled.

Name Link
🔨 Latest commit f04d9f1
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/641b9a6e0f6c72000886793f

@absoludity absoludity merged commit 03dd3bf into main Mar 23, 2023
38 checks passed
@absoludity absoludity deleted the fix-file-perms-for-discovery-cache branch March 23, 2023 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants