Skip to content

Commit

Permalink
feat: add image garbage collections
Browse files Browse the repository at this point in the history
Signed-off-by: PoAn Yang <[email protected]>
  • Loading branch information
FrankYang0529 committed Jul 16, 2024
1 parent efda82f commit 12c0743
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions docs/upgrade/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Here are some tips to troubleshoot a failed upgrade:
- Check [version-specific upgrade notes](./automatic.md#upgrade-support-matrix). You can click the version in the support matrix table to see if there are any known issues.
- Dive into the upgrade [design proposal](https://github.com/harvester/harvester/blob/master/enhancements/20220413-zero-downtime-upgrade.md). The following section briefly describes phases within an upgrade and possible diagnostic methods.

## Diagnose the upgrade flow
## Diagnose the upgrade flow

A Harvester upgrade process contains several phases.
A Harvester upgrade process contains several phases.
![](/img/v1.2/upgrade/ts_upgrade_phases.png)

### Phase 1: Provision upgrade repository VM.
Expand Down Expand Up @@ -200,3 +200,14 @@ deployment.apps/hvst-upgrade-xxxxx-upgradelog-downloader scaled
```

:::

### Cleanup unused images for enough disks to avoid image garbage collections

The default value of `imageGCHighThresholdPercent` in [KubeletConfiguration](https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/#kubelet-config-k8s-io-v1beta1-KubeletConfiguration) is `85`. If kubelet detects disk usage is more than 85%, it tries to remove unused images.

During Harvester upgrade, the system loads new images to each node. If disk usage is more than 85%, new images may be candidates for cleanup, because it's not used by any container.
In an airgapped environment, this may break the upgrade, because new images can't be found in the cluster.

If you get error message like 'Node xxx will reach xx.xx% storage space after loading new images. It's higher than kubelet image garbage collection threshold 85%.', you can run `crictl rmi --prune` to cleanup unused images first, before new upgrade starts.

![Disk space not enough error message](/img/v1.4/upgrade/disk-space-not-enough-error-message.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 13 additions & 2 deletions versioned_docs/version-v1.3/upgrade/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Here are some tips to troubleshoot a failed upgrade:
- Check [version-specific upgrade notes](./automatic.md#upgrade-support-matrix). You can click the version in the support matrix table to see if there are any known issues.
- Dive into the upgrade [design proposal](https://github.com/harvester/harvester/blob/master/enhancements/20220413-zero-downtime-upgrade.md). The following section briefly describes phases within an upgrade and possible diagnostic methods.

## Diagnose the upgrade flow
## Diagnose the upgrade flow

A Harvester upgrade process contains several phases.
A Harvester upgrade process contains several phases.
![](/img/v1.2/upgrade/ts_upgrade_phases.png)

### Phase 1: Provision upgrade repository VM.
Expand Down Expand Up @@ -200,3 +200,14 @@ deployment.apps/hvst-upgrade-xxxxx-upgradelog-downloader scaled
```

:::

### Cleanup unused images for enough disks to avoid image garbage collections

The default value of `imageGCHighThresholdPercent` in [KubeletConfiguration](https://kubernetes.io/docs/reference/config-api/kubelet-config.v1beta1/#kubelet-config-k8s-io-v1beta1-KubeletConfiguration) is `85`. If kubelet detects disk usage is more than 85%, it tries to remove unused images.

During Harvester upgrade, the system loads new images to each node. If disk usage is more than 85%, new images may be candidates for cleanup, because it's not used by any container.
In an airgapped environment, this may break the upgrade, because new images can't be found in the cluster.

If you get error message like 'Node xxx will reach xx.xx% storage space after loading new images. It's higher than kubelet image garbage collection threshold 85%.', you can run `crictl rmi --prune` to cleanup unused images first, before new upgrade starts.

![Disk space not enough error message](/img/v1.4/upgrade/disk-space-not-enough-error-message.png)

0 comments on commit 12c0743

Please sign in to comment.