Accessing nginx-ingress-controller error log

13,462

Solution 1

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

Solution 2

In most cases, you will see that containerized applications spit out their logs to stdout/stderr, which means they are available as container logs. In Kubernetes you can access these logs by means of ie. kubectl logs <pod>

Update: a very nice tool for logs cli browsing - https://github.com/wercker/stern

Solution 3

I prefer: kubectl logs -lapp=nginx-ingress

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

Share:
13,462

Related videos on Youtube

Uma Maheswari
Author by

Uma Maheswari

Updated on September 14, 2022

Comments

  • Uma Maheswari
    Uma Maheswari about 1 year

    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.

  • Uma Maheswari
    Uma Maheswari about 6 years
    Yes I did accessed the log using kubectl logs. But I hope it is only stdout logs. It has both stdout and stderr logs? Please confirm.
  • Radek 'Goblin' Pieczonka
    Radek 'Goblin' Pieczonka about 6 years
    yep, it has both