メモがてら投稿です
独自のnginx.confをマウントする
通常/etc/nginx/conf.d
にconfファイルをマウントすることで(デフォルトの)nginx
イメージにnginx設定を行えます。
ただしこの場合、worker_processes
などルートに書き込む必要のある設定が行えません
subPathを使ってマウントする
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: nginx-root-conf
mountPath: /etc/nginx/nginx.conf # マウント先指定
subPath: nginx.conf # 特定のファイルをマウント
volumes:
- name: nginx-root-conf
configMap:
name: nginx-root-conf
items:
- key: nginx_root.conf
path: nginx.conf # ファイル名を変更
---