Kubernetes Logs - How to get logs for kube-system pods

Denis Biondic picture Denis Biondic · Jul 19, 2017 · Viewed 21.2k times · Source

How do you get logs from kube-system pods? Running kubectl logs pod_name_of_system_pod does not work:

λ kubectl logs kube-dns-1301475494-91vzs
Error from server (NotFound): pods "kube-dns-1301475494-91vzs" not found

Here is the output from get pods:

λ kubectl get pods --all-namespaces

NAMESPACE     NAME                                             READY     STATUS    RESTARTS   AGE
default       alternating-platypus-rabbitmq-3309937619-ddl6b   1/1       Running   1          1d
kube-system   kube-addon-manager-minikube                      1/1       Running   1          1d
kube-system   kube-dns-1301475494-91vzs                        3/3       Running   3          1d
kube-system   kubernetes-dashboard-rvm78                       1/1       Running   1          1d
kube-system   tiller-deploy-3703072393-x7xgb                   1/1       Running   1          1d

Answer

Radek 'Goblin' Pieczonka picture Radek 'Goblin' Pieczonka · Jul 19, 2017

Use the namespace param to kubectl : kubectl --namespace kube-system logs kubernetes-dashboard-rvm78