Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing nginx-ingress-controller error log

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.

like image 986
Uma Maheswari Avatar asked Sep 28 '17 11:09

Uma Maheswari


2 Answers

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
like image 170
Aditya Vikas Devarapalli Avatar answered Sep 26 '22 00:09

Aditya Vikas Devarapalli


I prefer: kubectl logs -lapp=nginx-ingress

(get the logs of all pods with the label nginx-ingress)

like image 42
simon Avatar answered Sep 23 '22 00:09

simon