4 - 日志
Rancher can integrate with a variety of popular logging services and tools that exist outside of your Kubernetes clusters.
Rancher supports the following services:
Advantages
Setting up a logging service to collect logs from your cluster/project is helpful several ways:
- Logs errors and warnings in your Kubernetes infrastructure to a stream. The stream informs you of events like a container crashing, a pod eviction, or a node dying.
- Allows you to capture and analyze the state of your cluster and look for trends in your environment using the log stream.
- Helps you when troubleshooting or debugging.
- Saves your logs to a safe location outside of your cluster, so that you can still access them even if your cluster encounters issues.
Logging Scope
You can configure logging at either cluster or project level.
Note: You can only configure one logging service per cluster or project.
- If you’re a cluster owner or member who works in operations or security, configure cluster logging.
Cluster logging writes logs for every pod in the cluster and, in RKE clusters, Kubernetes system components. Logs from the following locations are sent to your logging service:
The
/var/log/containers
path for pod logging.The
/var/lib/rancher/rke/logs/
path for Kubernetes system components.
- If you’re a project owner or member who works on an application, configure project logging.
Project logging writes logs for every pod in the project (/var/log/containers
).
After collection, all logs are stored by your logging service. Log into your service to view them.