Skip to content

Commit 302679c

Browse files
authored
Merge pull request #45259 from mxpv/log-dir
Document changing pod logs directory in kubelet
2 parents 463ce41 + 65daa2a commit 302679c

File tree

1 file changed

+18
-2
lines changed
  • content/en/docs/concepts/cluster-administration

1 file changed

+18
-2
lines changed

content/en/docs/concepts/cluster-administration/logging.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ If systemd is not present, the kubelet and container runtime write to `.log` fil
157157
run the kubelet via a helper tool, `kube-log-runner`, and use that tool to redirect
158158
kubelet logs to a directory that you choose.
159159

160-
The kubelet always directs your container runtime to write logs into directories within
160+
By default, kubelet directs your container runtime to write logs into directories within
161161
`/var/log/pods`.
162162

163163
For more information on `kube-log-runner`, read [System Logs](/docs/concepts/cluster-administration/system-logs/#klog).
@@ -175,7 +175,7 @@ If you want to have logs written elsewhere, you can indirectly
175175
run the kubelet via a helper tool, `kube-log-runner`, and use that tool to redirect
176176
kubelet logs to a directory that you choose.
177177

178-
However, the kubelet always directs your container runtime to write logs within the
178+
However, by default, kubelet directs your container runtime to write logs within the
179179
directory `C:\var\log\pods`.
180180

181181
For more information on `kube-log-runner`, read [System Logs](/docs/concepts/cluster-administration/system-logs/#klog).
@@ -189,6 +189,22 @@ the `/var/log` directory, bypassing the default logging mechanism (the component
189189
do not write to the systemd journal). You can use Kubernetes' storage mechanisms
190190
to map persistent storage into the container that runs the component.
191191

192+
Kubelet allows changing the pod logs directory from default `/var/log/pods`
193+
to a custom path. This adjustment can be made by configuring the `podLogsDir`
194+
parameter in the kubelet's configuration file.
195+
196+
{{< caution >}}
197+
It's important to note that the default location `/var/log/pods` has been in use for
198+
an extended period and certain processes might implicitly assume this path.
199+
Therefore, altering this parameter must be approached with caution and at your own risk.
200+
201+
Another caveat to keep in mind is that the kubelet supports the location being on the same
202+
disk as `/var`. Otherwise, if the logs are on a separate filesystem from `/var`,
203+
then the kubelet will not track that filesystem's usage, potentially leading to issues if
204+
it fills up.
205+
206+
{{< /caution >}}
207+
192208
For details about etcd and its logs, view the [etcd documentation](https://etcd.io/docs/).
193209
Again, you can use Kubernetes' storage mechanisms to map persistent storage into
194210
the container that runs the component.

0 commit comments

Comments
 (0)