Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zh] Fix and improve determine cluster failures #445

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,44 @@
title: 集群故障判定
---

Karmada支持`Push`和`Pull`两种模式来管理成员集群,有关集群注册的更多详细信息,请参考[Cluster Registration](../clustermanager/cluster-registration.md)。
Karmada 支持 `Push` 和 `Pull` 两种模式来管理成员集群,有关集群注册的更多详细信息,
请参考 [Cluster Registration](../clustermanager/cluster-registration.md)。

在Karmada中,对集群的心跳探测有两种方式:
- 集群状态收集,更新集群的`.status`字段(包括`Push`和`Pull`两种模式);
- karmada控制面中`karmada-cluster`命名空间内的`Lease`对象,每个`Pull`模式集群都有一个关联的`Lease`对象。
在 Karmada 中,对集群的心跳探测有两种方式:

- 集群状态收集,更新集群的 `.status` 字段(包括 `Push` 和 `Pull` 两种模式);
- Karmada 控制面中 `karmada-cluster` 命名空间内的 `Lease` 对象,每个 `Pull` 模式集群都有一个关联的 `Lease` 对象。

## 集群状态收集

对于`Push`模式集群,Karmada控制面中的`clusterStatus`控制器将定期执行执行集群状态的收集任务;
对于`Pull`模式集群,集群中部署的 `karmada-agent`组件负责创建并定期更新集群的`.status`字段。
对于 `Push` 模式集群,Karmada 控制面中的 `clusterStatus` 控制器将定期执行执行集群状态的收集任务;
对于 `Pull` 模式集群,集群中部署的 `karmada-agent` 组件负责创建并定期更新集群的 `.status` 字段。

上述集群状态的定期更新任务可以通过 `--cluster-status-update-frequency` 标签进行配置(默认值为 10 秒)。

上述集群状态的定期更新任务可以通过`--cluster-status-update-frequency`标签进行配置(默认值为10秒)。
集群的 `Ready` 条件在满足以下条件时将会被设置为 `False`:

集群的`Ready`条件在满足以下条件时将会被设置为`False`:
- 集群持续一段时间无法访问;
- 集群健康检查响应持续一段时间不正常。

> 上述持续时间间隔可以通过`--cluster-failure-threshold`标签进行配置(默认值为30秒)。
> 上述持续时间间隔可以通过 `--cluster-failure-threshold` 标签进行配置(默认值为 30 秒)。

## 集群租约对象更新

每当有集群加入时,Karmada将为每个`Pull`模式集群创建一个租约对象和一个租赁控制器。
每当有集群加入时,Karmada 将为每个 `Pull` 模式集群创建一个租约对象和一个租赁控制器。

每个租约控制器负责更新对应的租约对象,续租时间可以通过`--cluster-lease-duration`和`--cluster-lease-renew-interval-fraction`标签进行配置(默认值为10秒)。
每个租约控制器负责更新对应的租约对象,续租时间可以通过 `--cluster-lease-duration`
和 `--cluster-lease-renew-interval-fraction` 标签进行配置(默认值为 10 秒)。

由于集群的状态更新由`clusterStatus`控制器负责维护,因此租约对象的更新过程与集群状态的更新过程相互独立。
由于集群的状态更新由 `clusterStatus` 控制器负责维护,因此租约对象的更新过程与集群状态的更新过程相互独立。

Karmada控制面中的`cluster`控制器将每隔`--cluster-monitor-period`时间(默认值为5秒)会检查`Pull`模式集群的状态,当`cluster`控制器在最后一个`--cluster-monitor-grace-period`时间段(默认值为40秒)内没有收到来着集群的消息时,集群的`Ready`条件将被更改为`Unknown`。
Karmada 控制面中的 `cluster` 控制器将每隔 `--cluster-monitor-period` 中配置的时间(默认值为 5 秒)检查 `Pull` 模式集群的状态,
当 `cluster` 控制器在最后一个 `--cluster-monitor-grace-period` 中配置的时间段(默认值为 40 秒)内没有收到来自集群的消息时,
集群的 `Ready` 条件将被更改为 `Unknown`。

## 检查集群状态

你可以使用`kubectl`来检查集群的状态细节:
你可以使用 `kubectl` 来检查集群的状态细节:
```
kubectl describe cluster <cluster-name>
```
Expand Down