update nginx-deployment.yaml
This commit is contained in:
parent
e07a5979d9
commit
0d579710ef
@ -96,6 +96,20 @@ spec:
|
||||
runAsUser: 65534
|
||||
fsGroup: 65534
|
||||
|
||||
# 添加初始化容器来设置日志目录权限
|
||||
initContainers:
|
||||
- name: init-nginx-logs
|
||||
image: busybox
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- mkdir -p /usr/local/nginx/logs;
|
||||
chmod 777 /usr/local/nginx/logs;
|
||||
touch /usr/local/nginx/logs/error.log /usr/local/nginx/logs/access.log;
|
||||
chmod 666 /usr/local/nginx/logs/error.log /usr/local/nginx/logs/access.log;
|
||||
volumeMounts:
|
||||
- name: nginx-logs
|
||||
mountPath: /usr/local/nginx/logs
|
||||
|
||||
containers:
|
||||
- name: nginx
|
||||
# 使用私有仓库中的镜像(需要根据实际情况修改)
|
||||
@ -160,6 +174,9 @@ spec:
|
||||
mountPath: /var/cache/nginx
|
||||
- name: nginx-run
|
||||
mountPath: /var/run
|
||||
# 添加日志目录挂载
|
||||
- name: nginx-logs
|
||||
mountPath: /usr/local/nginx/logs
|
||||
|
||||
volumes:
|
||||
- name: nginx-config-volume
|
||||
@ -170,6 +187,9 @@ spec:
|
||||
emptyDir: {}
|
||||
- name: nginx-run
|
||||
emptyDir: {}
|
||||
# 添加日志目录卷
|
||||
- name: nginx-logs
|
||||
emptyDir: {}
|
||||
|
||||
# 节点选择器(可选)
|
||||
nodeSelector:
|
||||
|
Loading…
x
Reference in New Issue
Block a user