Skip to content

Commit 9908e9a

Browse files
committed
[docs] add log rotation information
this commit documents the automatic log rotation for managed Windows services in the Enabled features section in the README.md
1 parent eee58be commit 9908e9a

File tree

2 files changed

+90
-2
lines changed

2 files changed

+90
-2
lines changed

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,31 @@ in a healthy state with no disruptions.
246246

247247
## Enabled features
248248

249+
### Automatic log rotation for managed Windows services
250+
251+
Automatic rotation of the log files for the managed Windows services is available to prevent disk space
252+
exhaustion. Uses [kube-log-runner](https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/component-base/logs/kube-log-runner)
253+
as a wrapper binary that executes the service while capturing stdout/stderr, rotates logs based on size
254+
and automatically cleaning up old files based on age.
255+
256+
For details on the log rotation naming convention, please refer to the [kube-log-runner documentation](https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/component-base/logs/kube-log-runner)
257+
258+
The log rotation functionality is disabled by default, causing log files to grow indefinitely.
259+
260+
Managed Windows services with log rotation capabilities:
261+
- kubelet
262+
- kube-proxy
263+
264+
Not yet supported:
265+
- containerd
266+
- csi-proxy
267+
- windows_exporter
268+
- hybrid-overlay-node
269+
- azure-cloud-node-manager
270+
271+
For instructions to enable, customize or disable log rotation refer to
272+
[log rotation for managed Windows services documentation](docs/log-rotation-managed-services.md).
273+
249274
### Autoscaling Windows nodes
250275
Cluster autoscaling is supported for Windows instances.
251276

@@ -257,7 +282,7 @@ Cluster autoscaling is supported for Windows instances.
257282
Windows instances brought up with WMCO are set up with the containerd container runtime. As WMCO installs and manages the container runtime,
258283
it is recommended not to preinstall containerd in MachineSet or BYOH Windows instances.
259284

260-
### Cluster-wide proxy
285+
### Cluster-wide proxy
261286
WMCO supports using a [cluster-wide proxy](https://docs.openshift.com/container-platform/latest/networking/enable-cluster-wide-proxy.html)
262287
to route egress traffic from Windows nodes on OpenShift Container Platform.
263288

@@ -297,7 +322,7 @@ Some valid values could be: `$mirrorRegistry/oss/kubernetes/pause:3.9`, `$mirror
297322

298323
### Horizontal Pod Autoscaling
299324
Horizontal Pod autoscaling is available for Windows workloads.
300-
Please follow the [Horizontal Pod autoscaling docs](https://docs.openshift.com/container-platform/latest/nodes/pods/nodes-pods-autoscaling.html)
325+
Please follow the [Horizontal Pod autoscaling docs](https://docs.openshift.com/container-platform/latest/nodes/pods/nodes-pods-autoscaling.html)
301326
to create a horizontal pod autoscaler object for CPU and memory utilization of Windows workloads.
302327

303328
## Limitations
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Log rotation for managed Windows services
2+
3+
Log rotation for managed Windows services is available for WMCO 10.22+. This feature rotates log files based
4+
on configurable size and age thresholds and is configured via environment variables in the operator.
5+
6+
## Enabling log rotation for managed Windows services
7+
8+
To enable and customize the log rotation behavior, add the following environment variables to the subscription (OLMv0).
9+
The operator will restart to load the newly added environment variables and apply log rotation to the
10+
managed services. This will result in a reconfiguration of the existing Windows nodes, one at a time, until all
11+
nodes have been handled, to minimize disruption.
12+
13+
### Setting environment variables in the subscription:
14+
```yaml
15+
kind: Subscription
16+
spec:
17+
config:
18+
env:
19+
- name: SERVICES_LOG_FILE_SIZE
20+
value: "100M" # Rotate when log reaches this size (suggested: 100M)
21+
- name: SERVICES_LOG_FILE_AGE
22+
value: "168h" # Keep rotated logs for this duration (e.g: 168h/7 days)
23+
- name: SERVICES_LOG_FLUSH_INTERVAL
24+
value: "5s" # Flush logs to disk at this interval (suggested: 5s)
25+
```
26+
27+
### Patching the subscription using the CLI:
28+
```shell script
29+
oc patch subscription <subscription_name> -n <namespace_name> \
30+
--type=merge \
31+
-p '{"spec":{"config":{"env":[{"name":"SERVICES_LOG_FILE_SIZE","value":"100M"},{"name":"SERVICES_LOG_FILE_AGE","value":"168h"},{"name":"SERVICES_LOG_FLUSH_INTERVAL","value":"5s"}]}}}'
32+
```
33+
34+
### Patching the operator deployment using the CLI (OLMv1 or manual installs):
35+
36+
```shell script
37+
oc set env deployment/windows-machine-config-operator -n <namespace_name> -c manager \
38+
SERVICES_LOG_FILE_SIZE="100M" \
39+
SERVICES_LOG_FILE_AGE="168h" \
40+
SERVICES_LOG_FLUSH_INTERVAL="5s"
41+
```
42+
where:
43+
- `<namespace_name>`: The namespace where the operator is installed (e.g., `openshift-windows-machine-config-operator`)
44+
- `<subscription_name>`: The name of the subscription used to install the operator (e.g., `windows-machine-config-operator-subscription`)
45+
46+
## Disabling log rotation for managed Windows services
47+
48+
To disable log rotation, remove the `SERVICES_LOG_FILE_SIZE`, `SERVICES_LOG_FILE_AGE`, and `SERVICES_LOG_FLUSH_INTERVAL`
49+
environment variables from the subscription or operator deployment.
50+
51+
## Behavior when log rotation settings change
52+
53+
**Effect on existing log files:** When rotation settings are changed (enabled, disabled, or updated), any previously
54+
rotated log files are retained according to the `SERVICES_LOG_FILE_AGE` value that was in effect when they were
55+
created. Once that retention period expires, the files are cleaned up automatically. New log files and any future
56+
rotated files will follow the updated rotation rules going forward.
57+
58+
**Operator and node behavior:** Any change to the `SERVICES_LOG_FILE_SIZE`, `SERVICES_LOG_FILE_AGE`, or
59+
`SERVICES_LOG_FLUSH_INTERVAL` environment variables—whether in the subscription (OLMv0) or the operator deployment
60+
(OLMv1 / manual installs)—will cause the operator to restart in order to load the updated configuration. After
61+
restarting, the operator will reconfigure each Windows node one at a time to apply the new log rotation settings,
62+
minimizing disruption. Note that service continuity during reconfiguration is not guaranteed; brief interruptions
63+
to managed services (such as kubelet or kube-proxy) may occur on each node as it is reconfigured.

0 commit comments

Comments
 (0)