kubectl 没有显示 username/password 的秘密?

kubectl doesnt show username/password of secret?

因此,我在我的集​​群中设置了一些秘密,但是当我想查看它们时,却没有数据响应:

a@b:~/ kubectl create secret generic test-sc --username=test --password='tested' 
secret/test-sc created

a@b:~/ kubectl describe secrets/test-sc
Name:         test-sc
Namespace:    default
Labels:       <none>
Annotations:  <none>

Type:  Opaque

Data
====

你的秘密不正确。

您正在指定文本,因此您应该使用 --from-literal

在你的例子中

kubectl create secret generic test-sc --from-literal=username=test --from-literal=password='tested'

这在 docs 中有解释。