kubernetes:如何将秘密 tls crt/key 与文件或 configMap 链接?

kubernetes:如何将秘密 tls crt/key 与文件或 configMap 链接?

有没有办法将秘密 tls crt/key 与文件链接起来?

apiVersion: v1
kind: Secret
metadata:
  name: hello-app-tls
  namespace: dev
type: kubernetes.io/tls
data:
  tls.crt: <crt_filePath>
  tls.key: <key_filePath>

或者引用 ConfigMap 中的值,例如:

apiVersion: v1
kind: Secret
metadata:
  name: hello-app-tls
  namespace: dev
type: kubernetes.io/tls
data:
  tls.crt:
    valueFrom:
       configMapKeyRef:
         name: configmap_tls
         key: crt
  tls.key:
    valueFrom:
       configMapKeyRef:
         name: configmap_tls
         key: key

错误:

Secret in version "v1" cannot be handled as a Secret: json: cannot unmarshal object into Go struct field Secret.data of type []uint8

相关内容