问题描述
我正在尝试将 ConfigMap 安装到 Nginx,但是当我安装 ConfigMap 时,我的 POD 无法启动并显示错误 Error: container has runAsNonRoot and image will run as root
我的部署.yaml
apiVersion: apps/v1
kind: Deployment
Metadata:
name: {{ template "fullname" . }}
namespace: {{ .Values.namespace }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}" # We dont need a large deployment history limit as Helm keeps it's own # history revisionHistoryLimit: 2 template:
Metadata:
namespace: {{ .Values.namespace }}
labels:
app: {{ template "fullname" . }}
release: "{{ .Release.Name }}"
spec:
containers:
- name: container
image: {{ template "docker-image" . }}
lifecycle:
preStop:
exec:
command: ["sleep","15"]
imagePullPolicy: Always
ports:
# The port that our container listens for HTTP requests on. Might also
# be 3000 or 8000
- containerPort: 8080
name: http
env:
# You can set environment variables that don't change across environments here
- name: ACTIVE_ENVIRONMENT
value: {{ .Values.environment }}
volumeMounts:
- name: msal-config-volume
mountPath: /etc/Nginx/html/assets/config.json
subPath: config.json
readOnly: true
resources: {{ toYaml .Values.resources | indent 10 }}
imagePullSecrets:
- name: secret
volumes:
- name: msal-config-volume
configMap:
name: msal-configmap
我的 /etc/Nginx/html/assets/
是我的人工部署,我试图从 ConfigMap 替换 config.json
文件。当我安装 msal-config-volume
时,pod 无法启动。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)