云容器引擎 CCE-集群系统密钥说明:default-secret
default-secret
default-secret的类型为kubernetes.io/dockerconfigjson,其data内容是登录SWR镜像仓库的凭据,用于从SWR拉取镜像。在CCE中创建工作负载时如果需要从SWR拉取镜像,需要配置imagePullSecrets的取值为default-secret,如下所示。
apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - image: nginx:alpine name: container-0 resources: limits: cpu: 100m memory: 200Mi requests: cpu: 100m memory: 200Mi imagePullSecrets: - name: default-secret
default-secret的data数据会定期更新,且当前的data内容会在一定时间后会过期失效。您可以使用describe命令在default-secret的中查看到具体的过期时间,如下所示。
在使用时请直接使用default-secret,而不要拷贝secret内容重新创建,因为secret里面的凭据会过期,从而导致无法拉取镜像。
$ kubectl describe secret default-secretName: default-secretNamespace: defaultLabels: secret-generated-by=cceAnnotations: temporary-ak-sk-expires-at: 2021-11-26 20:55:31.380909 +0000 UTCType: kubernetes.io/dockerconfigjsonData====.dockerconfigjson: 347 bytes