政策资讯

Policy Information


K8s的排错三兄弟

来源: 重庆市软件正版化服务中心    |    时间: 2024-11-22    |    浏览量: 156    |   
  • kubectl get 查看资源对象的状态信息)
  • kubectl describe  查询资源对象的属性信息
    Events下是事物日志,用来排错
  • Kubectl logs  查看容器报错信息
  •  查看 work 名称空间下的 pod 信息

[root@master ~]# kubectl -n work describe pod myhttp
Name: myhttp
Namespace: work
Priority: 0
Service Account: default
Node: node-0004/192.168.1.54
... ...
Events:
  Type Reason Age From Message
  ---- ------ ---- ---- -------
  Normal Scheduled 12m default-scheduler Successfully assigned work/myhttp
to node-0004
  Normal Pulling 12m kubelet Pulling image "myos:httpd"
  Normal Pulled 12m kubelet Successfully pulled image
"myos:httpd" in 3.678925795s (3.678930716s including waiting)
  Normal Created 12m kubelet Created container myhttp
  Normal Started 12m kubelet Started container myhttp

# 查看 myweb 日志
[root@master ~]# kubectl logs myweb
2024/11/22 13:42:38 [error] 7#0: *2 open() "/usr/local/nginx/html/info.php"
failed (2: No such file or directory), client: 10.244.219.64, server: localhost,
request: "GET /info.php HTTP/1.1", host: "10.244.243.193"
2024/11/22 13:42:39 [error] 6#0: *4 open() "/usr/local/nginx/html/info.php"
failed (2: No such file or directory), client: 10.244.219.64, server: localhost,
request: "GET /info.php HTTP/1.1", host: "10.244.243.193"
2024/11/22 13:42:39 [error] 6#0: *5 open() "/usr/local/nginx/html/info.php"
failed (2: No such file or directory), client: 10.244.219.64, server: localhost,
request: "GET /info.php HTTP/1.1", host: "10.244.243.193"

评论

QQ咨询 扫一扫加入群聊,了解更多平台咨询
微信咨询 扫一扫加入群聊,了解更多平台咨询
意见反馈
立即提交
QQ咨询
微信咨询
意见反馈