![](/img/trans.png)
[英]Kubernetes logs from kubectl logs command is different to /var/log/containers in GKE cluster
[英]Kubernetes pods logs are not getting by kubectl logs command
我正在使用帶有 Kube.netes 部署的 WordPress 站點構建。 在部署中,我只有一個容器 pod。 您能否闡明無法通過 kubectl logs 命令獲取日志的可能原因。 我也在容器上嘗試了 docker 日志,它也顯示了相同的 output。
#~$ kubectl logs -f <pod_name> -n <namespace>
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using xx.xx.xx.xx. Set the 'ServerName' directive globally to suppress this message
這是訪問域后日志中的唯一內容。
# docker logs -f <k8s_container_name>
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using xx.xx.xx.xx. Set the 'ServerName' directive globally to suppress this message
kubectl logs
顯示默認的STDOUT和STDERR
你需要寫file_put_contents('php://stderr', 'Your text goes to STDERR',FILE_APPEND);
文件中至少有 append,您可以從那里讀取,否則如果您正在開發 php WordPress,您也可以將日志推送到外部日志記錄。
閱讀更多: https://www.php.net/manual/en/features.commandline.io-streams.php & https://docs.docker.com/config/containers/logging/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.