按照config maps docs上的说明,我无法获取配置图的内容。我创建了配置
apiVersion: v1
kind: ConfigMap
metadata:
name: special-config
namespace: default
data:
special.how: very
special.type: charm
和pod
apiVersion: v1
kind: Pod
metadata:
name: dapi-test-pod
spec:
containers:
- name: test-container
image: gcr.io/google_containers/busybox
command: [ "busybox", "cat", "/etc/config/special.how" ]
volumeMounts:
- name: config-volume
mountPath: /etc/config
volumes:
- name: config-volume
configMap:
name: special-config
restartPolicy: Never
当我运行此pod时,我得到以下内容
kubectl logs dapi-test-pod
cat: can't open '/etc/config/special.how': No such file or directory
如果我将configMap名称更改为不存在的东西,则pod永远不会启动,所以基本上它似乎找到了配置映射,该卷似乎已经安装但其中没有任何内容。
按照从configMap使用env变量的指南正常工作,它似乎只是configMap作为有问题的文件。我完全陷入困境:(
Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.3+882d296", GitCommit:"882d296a99218da8f6b2a340eb0e81c69e66ecc7", GitTreeState:"not a git tree"}
Server Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0+$Format:%h$", GitCommit:"$Format:%H$", GitTreeState:"not a git tree"}