Maintenance operation scheduling#
You can schedule etcd maintenance tasks to run at a specific time.
Important
- To minimize the impact on cluster operations, Mirantis recommends that you schedule maintenance operations to run during times of low cluster activity.
- Maintenance operations must be scheduled at least 72 hours (3 days) apart. This minimum interval is enforced by validation and prevents excessive cluster disruption.
- Cron scheduling relies on controller machine system time, thus you should make sure to schedule the cron for the appropriate time zone. For example, if controller machines are running in UTC, then the cron schedule should also be set in UTC.
Configuration#
Configure etcd maintenance scheduling in the mke4.yaml configuration file
under spec.etcd.maintenanceService. Refer to the table below for
configuration parameter details:
| Parameter | Description |
|---|---|
cleanupEnabled |
Enables scheduled cleanup operations. Required for defragmentation. |
defragEnabled |
Optional. Enables scheduled defragmentation. Requires that cleanup operations take place first. |
cronExpression |
Cron expression that defines when maintenance operations are to be run. Maintenance operation runs must be scheduled at least 72 hours apart. |
minTTLToKeepSeconds |
Optional. Sets the minimum TTL, in seconds, for events to retain. |
defragPauseSeconds |
Optional. Sets the pause duration between defragmentation operations on members. |
defragTimeoutSeconds |
Optional. Sets the timeout duration for defragmentation operations. |
Example configuration
apiVersion: mke.mirantis.com/v1alpha1
kind: MkeConfig
metadata:
name: mke
namespace: mke
spec:
etcd:
maintenanceService:
cleanupEnabled: true
defragEnabled: true
cronExpression: "0 0 2 * * SUN"
defragPauseSeconds: 60
defragTimeoutSeconds: 600
Format the cron expression#
The etcd maintenance service supports two cron expression formats:
- Full crontab specification
- Descriptor
| Type   | Format ; | Detail |
|---|---|---|
| Full crontab specification | <seconds> <minutes> <hours> <day-of-month> <month> <day-of-week> | Field Order:
Examples:
|
| Descriptor | @ prefix Simplified expressions for common intervals. Less precise and not recommended if defragmentation is enabled. |
Standard descriptors:
@daily. Interval descriptors:
Examples:
|
Verification#
Following configuration, verify that the schedule is working:
-
SSH into any controller node:
ssh -i <path_to_ssh_key> user@<controller_node_ip> -
Check service status. The etcd maintenance service runs as a systemd service on each control plane node.
-
Check service logs to determine when the maintenance operations have been run:
sudo journalctl -u etcdmaintenance -f -
Use the HTTP API to monitor etcd status:
curl http://localhost:18088/cluster/status