LoginSignup
0
0

More than 3 years have passed since last update.

nginxのk8sコンテナに独自のnginx.confをマウントする

Posted at

メモがてら投稿です

独自の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 # ファイル名を変更
---

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0