问题
After installing kubernetes cluster following this guide I decided to check logs of system pod kube-scheduler to ensure that all works fine:
kubectl logs --namespace kube-system kube-scheduler-user223225-pc
but I got next error message:
Error from server: Get https://10.2.2.131:10250/containerLogs/kube-system/kube-scheduler-user-pc/kube-scheduler: dial tcp 10.2.2.131:10250: getsockopt: no route to host
I try to get logs from other pods and got the same error.
I run the cluster on Ubuntu 16.04 and chose flannel network installed using the next commands:
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl create -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel-rbac.yml
kubectl create --namespace kube-system -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Maybe, I missed something, also I see people suggest to configure firewall but it didn't help me:
sudo systemctl stop kubelet
sudo systemctl stop docker
sudo ifconfig cni0 down
sudo ifconfig flannel.1 down
sudo ifconfig docker0 down
sudo service docker start
sudo service kubelet start
sudo iptables -A FORWARD -i cni0 -j ACCEPT
sudo iptables -A FORWARD -o cni0 -j ACCEPT
Does someone know how to fix the issue with getting logs? Thank you in advance.
回答1:
kubernetes process log will be logged in node syslog. you can look at /var/log/syslog file.
to validate the cluster configuration use kubectl
command.
e.g.
kubectl get nodes kubectl get pods -o wide
also you can install the dashboard UI to check the cluster.
来源:https://stackoverflow.com/questions/44717222/cant-see-logs-of-kubernetes-pod