gpt4 book ai didi

kubernetes - 如何挂载 kubernetes.io/dockerconfigjson

转载 作者:行者123 更新时间:2023-12-05 00:47:35 28 4
gpt4 key购买 nike

我有一个 kubernetes.io/dockerconfigjson 类型的 secret :

$ kubectl describe secrets dockerjson

Name: dockerjson
Namespace: my-prd
Labels: <none>
Annotations: <none>

Type: kubernetes.io/dockerconfigjson

Data
====
.dockerconfigjson: 1335 bytes

当我尝试将这个 secret 挂载到容器中时 - 我找不到 config.json:

- name: dump
image: kaniko-executor:debug
imagePullPolicy: Always
command: ["/busybox/find", "/", "-name", "config.json"]
volumeMounts:
- name: docker-config
mountPath: /foobar
volumes:
- name: docker-config
secret:
secretName: dockerjson
defaultMode: 256

只打印:

/kaniko/.docker/config.json

这是完全支持还是我做错了什么?

我正在使用 OpenShift 3.9 - 应该是 Kubernetes 1.9。

最佳答案

apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug-v0.9.0
command:
- /busybox/cat
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 0.5
memory: 500Mi
tty: true
volumeMounts:
- name: docker-config
mountPath: /kaniko/.docker/
volumes:
- name: docker-config
secret:
secretName: dockerjson
items:
- key: .dockerconfigjson
path: config.json

关于kubernetes - 如何挂载 kubernetes.io/dockerconfigjson,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56361831/

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