[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for Apache Kafka®](../index.md) > [Concepts](index.md) > Maintenance

# Maintenance in Managed Service for Apache Kafka®

Maintenance includes:

* Automatic installation of Apache Kafka® updates and patches for hosts (including for stopped clusters).
* Scheduled [automatic storage expansion](storage.md#auto-rescale).
* Other maintenance activities.

Maintenance includes changes within one Apache Kafka® major version. Learn more about migrating between major versions [here](../operations/cluster-version-update.md).

## Maintenance window {#maintenance-window}

You can set the maintenance window when [creating a cluster](../operations/cluster-create.md) or [updating its settings](../operations/cluster-update.md):

* The **At any time** option (default) allows performing maintenance at any time.
* The **By schedule** option allows you to select the day of the week and UTC time when the maintenance will be performed. For example, you can choose a time when the cluster is least loaded.

{% note info %}

To view maintenance task information, you need the `managed-kafka.maintenanceTask.viewer` [role](../security/index.md#managed-kafka-maintenanceTask-viewer) or higher.

To manage maintenance tasks, you need the `managed-kafka.maintenanceTask.editor` [role](../security/index.md#managed-kafka-maintenanceTask-editor) or higher.

{% endnote %}

## Maintenance workflow {#maintenance-order}

In single-host Managed Service for Apache Kafka® clusters, a single [broker host](brokers.md) undergoes maintenance. This means, if you restart such a cluster during maintenance, it will become unavailable.

In multi-host clusters, broker hosts undergo maintenance one by one. Such hosts are queued randomly. A broker host becomes unavailable while it is being restarted during maintenance.

## Karapace availability {#karapace}

[Karapace](https://github.com/Aiven-Open/karapace) is unavailable during maintenance and automatically restarts after its completion. Meanwhile, all schema data is retained as it is stored in the `__schema_registry` [service topic](topics.md#service-topics).

[Learn more about managing data schemas](managed-schema-registry.md).