我需要在高度依赖MongoDB的openshift上部署一个应用程序,以带来主要的API容器。此处的约束是部署中使用的MongoDB映像需要以root用户身份运行,但openshift不允许这样做。可以在这附近走走吗?
我已经尝试过此链接下提到的解决方案 https://github.com/openshift/origin/issues/17164
Deployment.yaml
- apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: mongo
namespace: default
spec:
selector:
matchLabels:
app: mongo
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: mongo
role: master
tier: backend
spec:
initContainers:
- name: config-data-path
image: busybox
command:
- /bin/chmod
- -R
- "777"
- /data/db
volumeMounts:
- name: data
mountPath: /data/db
containers:
- name: mongo
image: mongo
ports:
- containerPort: 27017
volumeMounts:
- name: data
mountPath: /data/db
volumes:
- name: data
persistentVolumeClaim:
claimName: mongo-pv-claim
来自容器的错误日志。
chmod: /data/db: Permission denied
chmod: /data/db: Permission denied