I want to create a file based on the value of a key from a ConfigMap. I'm following the ConfigMap guide on how to setup a volume that is populated from a ConfigMap but it doesn't seem to be working.
Here is my ConfigMap:
apiVersion: v1
data:
redis-config: |
maxmemory 2mb
maxmemory-policy allkeys-lru
kind: ConfigMap
metadata:
name: example-redis-config
And my pod:
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
Both of those are just copied from the guide. I've then created both via kubectl
. However, the redis
container fails to start. Checking the logs gives the following error:
$ kubectl logs redis
[7] 24 May 22:22:53.146 # Fatal error, can't open config file '/redis-master/redis.conf'
What am I doing wrong?