我试图将ConfigMap挂载到Pod中的文件目录。该目录正在显示,但其中没有文件。这是我申请kubectl apply -f spec.yaml
的spec.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: config-map-1
data:
key-1: Wow I am such a config
---
apiVersion: v1
kind: Pod
metadata:
name: file-printer
spec:
volumes:
- name: config-volume
configMap:
name: config-map-1
containers:
- name: file-printer
image: gcr.io/google_containers/busybox
volumeMounts:
- name: config-volume
mountPath: /config-map-file
command: ["ls", "/", "/config-map-file"]
restartPolicy: Never
我正在运行ls / /config-map-file
所以我可以看到正在创建目录,但它没有填充:
bash-3.2$ kubectl logs file-printer
/:
bin
config-map-file
dev
[...snip...]
usr
var
/config-map-file:
bash-3.2$
我希望/config-map-file
有一个名为key-1
的文件,但它是空的:(
这是kubectl describe pod file-printer
的输出:
bash-3.2$ kubectl describe pod file-printer
Name: file-printer
Namespace: default
Node: 127.0.0.1/127.0.0.1
Start Time: Mon, 04 Apr 2016 20:28:33 -0500
Labels: <none>
Status: Succeeded
IP: 172.17.0.2
Controllers: <none>
Containers:
file-printer:
Container ID: docker://5d08d31a8b06665ce50ba1147df8473a5997406813edff1fa2126cb48464a979
Image: gcr.io/google_containers/busybox
Image ID: docker://sha256:e7d168d7db455c45f4d0315d89dbd18806df4784f803c3cc99f8a2e250585b5b
Port:
Command:
ls
/
/config-map-file
QoS Tier:
cpu: BestEffort
memory: BestEffort
State: Terminated
Reason: Completed
Exit Code: 0
Started: Mon, 04 Apr 2016 20:28:36 -0500
Finished: Mon, 04 Apr 2016 20:28:36 -0500
Ready: False
Restart Count: 0
Environment Variables:
Conditions:
Type Status
Ready False
Volumes:
config-volume:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: config-map-1
default-token-e5g2d:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-e5g2d
Events:
FirstSeen LastSeen Count From SubobjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
3s 3s 1 {default-scheduler } Normal Scheduled Successfully assigned file-printer to 127.0.0.1
2s 2s 1 {kubelet 127.0.0.1} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "POD" with RunContainerError: "addNDotsOption: ResolvConfPath \"/mnt/sda1/var/lib/docker/containers/9472967c2cb9f471067e87560f061647afb9b353c6548f3b64cc06c034e5fe1f/resolv.conf\" does not exist"
1s 1s 1 {kubelet 127.0.0.1} spec.containers{file-printer} Normal Pulling pulling image "gcr.io/google_containers/busybox"
0s 0s 1 {kubelet 127.0.0.1} spec.containers{file-printer} Normal Pulled Successfully pulled image "gcr.io/google_containers/busybox"
0s 0s 1 {kubelet 127.0.0.1} spec.containers{file-printer} Normal Created Created container with docker id 5d08d31a8b06
0s 0s 1 {kubelet 127.0.0.1} spec.containers{file-printer} Normal Started Started container with docker id 5d08d31a8b06
0s 0s 1 {kubelet 127.0.0.1} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "file-printer" with RunContainerError: "failed to apply oom-score-adj to container \"exceeded maxTries, some processes might not have desired OOM score\"- /k8s_file-printer.903c39c6_file-printer_default_b64f103c-facd-11e5-b027-7eac684371ee_aa7b4c91"
我错过了什么?客户&amp;服务器都运行1.2.0。