使用 Cloud Code for VS Code 在 Kubernetes 中存储敏感信息
本页面简要介绍了 Kubernetes Secret 的含义,以及 Cloud Code 如何帮助启用 Secret Manager API 来创建、使用和存储 Secret。
Kubernetes Secret 简介
创建 Kubernetes 应用时,通常需要传递少量密码、SSH 密钥或 OAuth 令牌等敏感数据。您可以创建 Kubernetes Secret 来存储敏感数据,而不是将此类信息存储在 Pod 规范或容器映像中。
默认情况下,Kubernetes Secret 会以未加密形式存储在 API 服务器的底层数据存储区中。拥有 API 访问权限的任何人都可以检索或修改密钥。Kubernetes Secret 文档建议您至少执行以下步骤,以便安全地使用 Kubernetes Secret:
Cloud Code 中的 Secret Manager
Cloud Code 可帮助您使用 Secret Manager API 在 IDE 中创建、版本化和存储密文,并采用静态加密。您可以仅在 Cloud Code 中使用 Secret Manager,也可以将其与您已在使用的其他 Secret 管理工具搭配使用。
在 IDE 中使用 Cloud Code 时可执行的操作包括:
在 Cloud Code 中使用 Kubernetes Secret
如需了解如何在 Cloud Code 中创建、版本控制、使用和删除 Secret,请参阅管理 Secret。
后续步骤
获取支持
如需发送反馈,请在
GitHub 上报告问题,或者在
Stack Overflow 上提问。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-11。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-11。"],[[["\u003cp\u003eKubernetes secrets are used to store sensitive data like passwords and tokens, rather than storing them directly in pod specifications or container images.\u003c/p\u003e\n"],["\u003cp\u003eBy default, Kubernetes secrets are stored unencrypted, so it is recommended to enable encryption at rest, configure RBAC rules, and consider external secret store providers.\u003c/p\u003e\n"],["\u003cp\u003eCloud Code enables users to leverage the Secret Manager API to create, version, and securely store secrets with encryption at rest directly from within the IDE.\u003c/p\u003e\n"],["\u003cp\u003eWith Cloud Code, you can enable the Secret Manager API, create and manage Kubernetes secrets, add them as environment variables, and mount them as volumes.\u003c/p\u003e\n"],["\u003cp\u003eThe Kubernetes Documentation provides further insight into the good practices and alternatives to secrets, such as service account tokens.\u003c/p\u003e\n"]]],[],null,[]]