I have set up one Kubernetes master node and 2 workers node. I deployed two web applications as a pod using kubectl
. I deployed nginx-ingress-controller
( image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.6
) and created a service for the same with nodeport option. How do I access the error logs of the nginx-ingress-controller
? I'm able to see error.log
under /var/log/nginx/
, but it is link to /dev/stderr
.
TL;DR
kubectl logs -n <<ingress_namespace>> <<ingress_pod_name>>
Check the namespace under which the Ingress controller is currently running.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
helloworld-deployment-7dc448d6b-5zvr8 1/1 Running 1 3d20h
helloworld-deployment-7dc448d6b-82dnt 1/1 Running 1 3d20h
$ kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
kube-apiserver-minikube 1/1 Running 1 3d20h
nginx-ingress-controller-586cdc477c-rhj9z 1/1 Running 1 3d21h
For me, it happens to be the kube-system
namespace on the pod nginx-ingress-controller-586cdc477c-rhj9z
.
Now, get the logs just like you would or any other pod using
kubectl logs -n kube-system nginx-ingress-controller-586cdc477c-rhj9z
I prefer: kubectl logs -lapp=nginx-ingress
(get the logs of all pods with the label nginx-ingress)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With