看不到Kubernetes Pod的日志 [英] Can't see logs of kubernetes pod

查看:735
本文介绍了看不到Kubernetes Pod的日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照此指南我决定检查系统pod kube-scheduler 的日志,以确保一切正常:

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.

我在Ubuntu 16.04上运行集群,并选择使用以下命令安装的法兰绒网络:

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.

推荐答案

kubernetes进程日志将记录在节点syslog中.您可以查看/var/log/syslog文件.

kubernetes process log will be logged in node syslog. you can look at /var/log/syslog file.

使用kubectl命令验证集群配置.

to validate the cluster configuration use kubectl command.

例如

kubectl获取节点 kubectl得到豆荚-o宽

kubectl get nodes kubectl get pods -o wide

您还可以安装仪表板UI来检查集群.

also you can install the dashboard UI to check the cluster.

这篇关于看不到Kubernetes Pod的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆