I'm trying to troubleshoot a 404 message on my ingress. When I view logs using kubectl logs -n ingress-nginx ingress-nginx-controller-xxxxxx -f
I don't see any output when making a request to the URL. Is there a specific setting that allows me to see access/error logs?
I'm looking for what I would normally see when viewing /var/log/nginx/error.log
or /var/log/nginx/access.log
.
You can exec into the pods using
kubectl exec <pod_name> -n <namespace> <command>
and check if your application is creating log files in the paths that you have mentioned. If you are able to verify the existence of those files, you can add a busybox sidecar to the deployment and you can directly stream your logs using the sidecar and tail them usingkubectl logs
You can use the following template to do the same:
Add the following volume-mount to the existing deployment
And then you can add the sidecar using the following template
Please note that this will stream both your error and access logs into the same stream. Although, the correct method to do this is to create symlinks for error and access logs, the method I have mentioned can be used as an alternative.
Hope this helps!