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.
I prefer: kubectl logs -lapp=nginx-ingress
(get the logs of all pods with the label nginx-ingress)
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
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 3d21hFor 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