I want to edit my Nginx.conf file present inside Nginx controller pod in AKS, but the edit command is not working using the exec command,. is there any way else I could edit my nginx.conf.
the command which I tried: kubectl exec -it nginx-nginx-ingress-controller -n nginx -- cat /etc/nginx/nginx.conf
CodePudding user response:
Generally, it is a bad idea to exec into a pod to do changes. It violates the principle of infrastructure as code. You should extract the nginx.conf file to a ConfigMap and then mount it into the pod.
An example can be found here.
You can then edit the ConfigMap when needing to update the nginx config. Remember to redeploy the Pod to make the config apply.
CodePudding user response:
yh, seems this is also working. tried an alternative way:
Edit/add the properties to change in ingress.yaml and redeploy it. the changes will then reflect in nginx.conf
