gpt4 book ai didi

ruby - Kubernetes + Minikube - 如何查看所有标准输出?

转载 作者:数据小太阳 更新时间:2023-10-29 08:56:47 25 4
gpt4 key购买 nike

我正在使用 Minikube 在 Kubernetes 上运行 Ruby 应用程序。

但是,每当我查看日志时,我都看不到在本地运行应用程序时会在终端中看到的输出。

我猜这是因为它只显示了 stderr?

如何查看所有类型的控制台日志(例如来自 putsraise)?

环顾四周,这是否与处于分离模式有关 - 请参阅 Python 相关问题:Logs in Kubernetes Pod not showing up

谢谢。

=

根据要求 - 这是 deployment.yaml

apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: sample
spec:
replicas: 1
template:
metadata:
labels:
app: sample
spec:
containers:
- name: sample
image: someregistry
imagePullPolicy: Always
command: ["/bin/sh","-c"]
args: ["bundle exec rake sample:default --trace"]
envFrom:
- configMapRef:
name: sample
- secretRef:
name: sample
ports:
- containerPort: 3000
imagePullSecrets:
- name: regsecret

最佳答案

如本文所示,kubectl logs pod apod 应该向您显示部署在 minikube 中的 pod 的标准输出和标准错误。

By default in Kubernetes, Docker is configured to write a container's stdout and stderr to a file under /var/log/containers on the host system

Kubernetes adds :

There are two types of system components: those that run in a container and those that do not run in a container.
For example:

  • The Kubernetes scheduler and kube-proxy run in a container.
  • The kubelet and container runtime, for example Docker, do not run in containers.

和:

  • On machines with systemd, the kubelet and container runtime write to journald.
  • If systemd is not present, they write to .log files in the /var/log directory.

Similarly to the container logs, system component logs in the /var/log directory should be rotated.
In Kubernetes clusters brought up by the kube-up.sh script, those logs are configured to be rotated by the logrotate tool daily or once the size exceeds 100MB.

https://d33wubrfki0l68.cloudfront.net/59b1aae2adcfe4f06270b99a2789012ed64bec1f/4d0ad/images/docs/user-guide/logging/logging-node-level.png

关于ruby - Kubernetes + Minikube - 如何查看所有标准输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52866915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com