尊敬的 K8S 社区团队,
部署应用程序 pod 时,我从 nginx 收到此错误消息。我的应用程序 angular6 应用程序托管在 nginx 服务器内,该服务器部署为 EKS 内的 docker 容器。
我将我的应用程序配置为“只读容器文件系统”,但我将“emptyDir”类型的“临时挂载”卷与只读文件系统结合使用。
所以我不确定以下错误的原因:
2019/04/02 14:11:29 [emerg] 1#1: mkdir() "/var/cache/nginx/client_temp" 失败 (30: 只读文件系统) nginx: [emerg] mkdir() "/ var/cache/nginx/client_temp" 失败(30:只读文件系统)
我deployment.yaml
的是:
...
spec:
volumes:
- name: tmp-volume
emptyDir: {}
# Pod Security Context
securityContext:
fsGroup: 2000
containers:
- name: {{ .Chart.Name }}
volumeMounts:
- mountPath: /tmp
name: tmp-volume
image: "{{ .Values.image.name }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
securityContext:
readOnlyRootFilesystem: true
ports:
- name: http
containerPort: 80
protocol: TCP
...
nginx.conf 是:
...
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Turn off the bloody buffering to temp files
proxy_buffering off;
sendfile off;
keepalive_timeout 120;
server_names_hash_bucket_size 128;
# These two should be the same or nginx will start writing
# large request bodies to temp files
client_body_buffer_size 10m;
client_max_body_size 10m;
...