rahul patwa
rahul patwa

Reputation: 9

How to set nginx.conf permanently in kuberenetes ingress?

Our nginx controller does not support the SSL from windows 7 systems. We updated the cipher suites in the nginx.conf file in Kubernetes Nginx pods, and it started to work.

Now the issue is whenever the service restarts or the pod restarts the nginx.conf file resets to the default one.

How can we set the nginx.conf file permanently?

Upvotes: 0

Views: 973

Answers (1)

Taybur Rahman
Taybur Rahman

Reputation: 1457

Create a config map for your nginx.conf and attached it to your pod in specific location.

Create config map by running the bellow command.

kubectl create configmap nginx-conf --from-file=nginx.conf

And attached it in specific directory.

apiVersion: v1
kind: Pod
metadata:
  name: test
spec:
  containers:
    - name: test-container
      image: k8s.gcr.io/busybox
      command: [ "/bin/sh", "-c", "ls /etc/config/" ]
      volumeMounts:
      - name: nginx-config
        mountPath: /etc/nginx/
  volumes:
    - name: nginx-config
      configMap:
        # Provide the name of the ConfigMap containing the files you want
        # to add to the container
        name: nginx-config //your config map name here
  restartPolicy: Never

Upvotes: 1

Related Questions