我想根据ConfigMap中的键值创建一个文件。我关注如何设置从ConfigMap填充的卷ConfigMap guide,但它似乎无法正常工作。
这是我的ConfigMap:
apiVersion: v1
data:
redis-config: |
maxmemory 2mb
maxmemory-policy allkeys-lru
kind: ConfigMap
metadata:
name: example-redis-config
我的吊舱:
apiVersion: v1
kind: Pod
metadata:
name: redis
spec:
containers:
- name: redis
image: kubernetes/redis:v1
env:
- name: MASTER
value: "true"
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /redis-master
name: config
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: example-redis-config
items:
- key: redis-config
path: redis.conf
这些都只是从指南中复制而来。然后,我通过kubectl
创建了这两个广告。但是,redis
容器无法启动。检查日志会出现以下错误:
$ kubectl logs redis
[7] 24 May 22:22:53.146 # Fatal error, can't open config file '/redis-master/redis.conf'
我做错了什么?