大网数据广告活动
服务器运维问答

What does kubectl store in the cache?

· 52CE 我爱测

I see a cache directory in the .kube/ directory of my kubectl. I tried to find the purpose of this cache and how kubectl uses it in the kubernetes documentation here but couldn't find any clue. What does kubectl store in the .kub…

问题原文

原帖链接 · Akshay Hiremath · CC BY-SA 4.0

I see a cache directory in the .kube/ directory of my kubectl. I tried to find the purpose of this cache and how kubectl uses it in the kubernetes documentation here but couldn't find any clue.

What does kubectl store in the .kube/cache directory? and how this cache is used in the kubectl operation? What exactly kubectl caches?

已采纳解答

原帖链接 · mdaniel · CC BY-SA 4.0

By cursory examination, one will observe the discovery directory is the kubectl api-resources output, per cluster hostname, and the http sibling directory contains the response bodies for each of those individual api-resource requests. The latter is used for parsing its Etag in order to know whether the cache is intact or not.

The api-resources are a formal description of the verbs, URIs, and request/response bodies tolerated by a given kubernetes cluster, which includes any installed Custom Resource Definitions

The gory details are described by the godoc for NewCachedDiscoveryClientForConfig and that ~/.kube/config directory itself is under user influence via the --cache-dir flag to kubectl, as shown in the genericclioptions config_flags.go

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-01-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。