【发布时间】:2019-05-15 18:21:35
【问题描述】:
我正在尝试在 Kubernetes 中部署 redis 哨兵部署。我已经完成了,但想使用 ConfigMaps 来允许我们在 sentinel.conf 文件中更改主服务器的 IP 地址。我开始了这个,但 redis 无法写入配置文件,因为 configMaps 的挂载点是只读的。
我希望运行一个 init 容器并将 redis conf 复制到 pod 中的另一个目录。但是 init 容器找不到 conf 文件。
我有哪些选择?初始化容器? ConfigMap 以外的东西?
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: redis-sentinel
spec:
replicas: 3
template:
metadata:
labels:
app: redis-sentinel
spec:
hostNetwork: true
containers:
- name: redis-sentinel
image: IP/redis-sentinel
ports:
- containerPort: 63790
- containerPort: 26379
volumeMounts:
- mountPath: /redis-master-data
name: data
- mountPath: /usr/local/etc/redis/conf
name: config
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: sentinel-redis-config
items:
- key: redis-config-sentinel
path: sentinel.conf
【问题讨论】:
标签: docker kubernetes redis configmap