简体   繁体   English

如何重定向 Apache 登录 Kubernetes

[英]How to redirect the Apache log in Kubernetes

I am having one namespace and one deployment(replica set), My Apache logs should be written outside the pod, how is it possible in Kubernetes.我有一个命名空间和一个部署(副本集),我的 Apache 日志应该写在 pod 之外,怎么可能在 Kubernetes 中。

This is a Community Wiki answer so feel free to edit it and add any additional details you consider important.这是一个社区 Wiki 答案,因此请随时对其进行编辑并添加您认为重要的任何其他详细信息。

You should specify more precisely what you exactly mean by outside the pod , but as David Maze have already suggested in his comment, take a closer look at Logging Architecture section in the official kubernetes documentation .您应该更准确地指定您在 pod 外部的确切含义,但正如David Maze在他的评论中已经建议的那样,请仔细查看官方kubernetes 文档中的Logging Architecture部分。

Depending on what you mean by "outside the Pod" , different solution may be the most optimal in your case.根据您所说的“在 Pod 之外”的含义,在您的情况下,不同的解决方案可能是最佳的。

As you can read there:如您所见:

Kubernetes provides no native storage solution for log data, but you can integrate many existing logging solutions into your Kubernetes cluster... Cluster-level logging architectures are described in assumption that a logging backend is present inside or outside of your cluster. Kubernetes 没有为日志数据提供本机存储解决方案,但是您可以将许多现有的日志记录解决方案集成到您的 Kubernetes 集群中...集群级日志记录体系结构是在假设日志记录后端存在于集群内部或外部的情况下描述的。

Here are mentioned 3 most popular cluster-level logging architectures: 这里提到了 3 个最流行的集群级日志架构:

  • Use a node-level logging agent that runs on every node.使用在每个节点上运行的节点级日志记录代理。
  • Include a dedicated sidecar container for logging in an application pod.包括一个专用的 sidecar 容器,用于登录应用程序 pod。
  • Push logs directly to a backend from within an application.将日志从应用程序内直接推送到后端。

Second solution is widely used.第二种解决方案被广泛使用。 Unlike the third one where the logs pushing needs to be handled by your application container, sidecar approach is application independend, which makes it much more flexible solution.与需要由应用程序容器处理日志推送的第三种方法不同, sidecar 方法是应用程序独立的,这使得它的解决方案更加灵活。

So that the matter was not so simple, it can be implemented in two different ways:所以事情没有那么简单,可以通过两种不同的方式实现:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM