gpt4 book ai didi

kubernetes - 尝试在 kubernetes 中创建 secret 时遇到一些问题

转载 作者:行者123 更新时间:2023-12-03 13:20:41 28 4
gpt4 key购买 nike

我需要在 secrets.YAML 中存储一些密码和用户名。但是在部署之后出现此错误。因此无法构建 secret 并在 pod 中访问它。在下面附加 deployment.yaml 和 secret .yaml。

--Secrets.yaml

    apiVersion: v1
kind: Secret
metadata:
name: mysecret
data:
CassandraSettings__CassandraPassword: [[ .Environment ]]-abcd-cassandra-password

---部署.yaml

     env:
- name: Password
valueFrom:
secretKeyRef:
name: mysecret
key: CassandraSettings__CassandraPassword

在 TeamCity 中部署后出现此错误

Error from server (BadRequest): error when creating "STDIN": Secret in version "v1" cannot be handled as a Secret: v1.Secret.ObjectMeta: v1.ObjectMeta.TypeMeta: Kind: Data: decode base64: illegal base64 data at input byte 3, error found in #10 byte of ...|-password"},"kind":"|..., bigger context ...|_CassandraPassword":"dev-bling-cassandra-password"},"kind":"Secret","metadata":{"annotations":{"kube|... error parsing STDIN: error converting YAML to JSON: yaml: line 33: did not find expected '-' indicator

最佳答案

看起来类型丢失了,你可以尝试如下,

---Secrets.yaml

apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
CassandraSettings__CassandraPassword: [[ .Environment ]]-abcd-cassandra-password

---部署.yaml

    env:
- name: Password
valueFrom:
secretKeyRef:
name: mysecret
key: CassandraSettings__CassandraPassword

关于kubernetes - 尝试在 kubernetes 中创建 secret 时遇到一些问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59961285/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com