kubectl不显示密码的用户名/密码吗?

问题描述

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

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中有解释。