kubernetes - 如何挂载 kubernetes.io/dockerconfigjson
问题描述
我有一个类型的秘密kubernetes.io/dockerconfigjson
:
$ kubectl describe secrets dockerjson
Name: dockerjson
Namespace: my-prd
Labels: <none>
Annotations: <none>
Type: kubernetes.io/dockerconfigjson
Data
====
.dockerconfigjson: 1335 bytes
当我尝试将此秘密安装到容器中时 - 我找不到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
推荐阅读
- symfony - 在 postRemove 侦听器中创建的实体未持久化
- vue.js - Vue 监听 deep props 不触发
- payment-gateway - Elavon api:无法输入信用卡号
- winapi - 从什么时候开始 OPENFILENAME.lpstrDefExt 支持超过三个字符的扩展?
- jquery - 如何使用 Javascript 动态生成的 Jquery 修改对象?
- r - 如何将奇数数据成员拆分为训练集,将 10 的倍数拆分为 R 中的测试集?
- asp.net-web-api - pwinty api 回调 url 没有命中
- sql - SQL查询:最多选择同一行的2列
- javascript - owlCarousel 和触发 prev.owl.carousel 和 next.owl.carousel
- excel - Access/Excel 中基于先前匹配的模糊匹配