首页 > 如何使用 Kubernetes secrets 保存环境变量数据?

如何使用 Kubernetes secrets 保存环境变量数据?

官方文档的例子是简单定义变量,现在我想要把项目中的环境变量数据设置到 secret 中,尝试如下:

apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
data:
  RAILS_ENV: cHJvZHVjdGlvbg==

创建 secret:

kubectl create -f secret.yml

却提示:

The Secret "mysecret" is invalid:
* data[RAILS_ENV]: invalid value 'RAILS_ENV': must have at most 253 characters and match regex \.?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*

不符合命名规则,那么如何才能设置环境变量的大写字母呢?


base64 encode

【热门文章】
【热门文章】