You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/aks/image-cleaner.md
+26-13Lines changed: 26 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,20 +18,20 @@ It's common to use pipelines to build and deploy images on Azure Kubernetes Serv
18
18
19
19
* An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
20
20
*[Azure CLI][azure-cli-install] or [Azure PowerShell][azure-powershell-install] and the `aks-preview` CLI extension installed.
21
-
* The `ImageCleanerPreview` feature flag registered on your subscription:
21
+
* The `EnableImageCleanerPreview` feature flag registered on your subscription:
22
22
23
23
### [Azure CLI](#tab/azure-cli)
24
24
25
-
Register the `ImageCleanerPreview` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example:
25
+
Register the `EnableImageCleanerPreview` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example:
26
26
27
27
```azurecli-interactive
28
-
az feature register --namespace "Microsoft.ContainerService" --name "ImageCleanerPreview"
28
+
az feature register --namespace "Microsoft.ContainerService" --name "EnableImageCleanerPreview"
29
29
```
30
30
31
31
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [az feature list][az-feature-list] command:
32
32
33
33
```azurecli-interactive
34
-
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/ImageCleanerPreview')].{Name:name,State:properties.state}"
34
+
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/EnableImageCleanerPreview')].{Name:name,State:properties.state}"
35
35
```
36
36
37
37
When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [az provider register][az-provider-register] command:
@@ -42,16 +42,16 @@ az provider register --namespace Microsoft.ContainerService
42
42
43
43
### [Azure PowerShell](#tab/azure-powershell)
44
44
45
-
Register the `ImageCleanerPreview` feature flag by using the [Register-AzProviderPreviewFeature][register-azproviderpreviewfeature] cmdlet, as shown in the following example:
45
+
Register the `EnableImageCleanerPreview` feature flag by using the [Register-AzProviderPreviewFeature][register-azproviderpreviewfeature] cmdlet, as shown in the following example:
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [Get-AzProviderPreviewFeature][get-azproviderpreviewfeature] cmdlet:
@@ -72,11 +72,9 @@ ImageCleaner does not support the following:
72
72
73
73
## How ImageCleaner works
74
74
75
-
When enabled, an `eraser-controller-manager` pod is deployed on each agent node, which will use an `ImageList` CRD to determine unreferenced and vulnerable images. An `ImageList` can either be defined manually or automatically generated by ImageCleaner.
75
+
When enabled, an `eraser-controller-manager` pod is deployed on each agent node, which will use an `ImageList` CRD to determine unreferenced and vulnerable images. Vulnerability is determined based on a [trivy][trivy] scan, after which images with a `LOW`, `MEDIUM`, `HIGH`, or `CRITICAL` classification are flagged. An updated `ImageList` will be automatically generated by ImageCleaner based on a set time interval, and can also be supplied manually.
76
76
77
-
In manual mode, the `ImageList` is created based off of a provided list of image names. In automatic mode, a time interval is set. ImageCleaner will repeatedly run in this interval to generate an updated `ImageList`.
78
-
79
-
Once an `ImageList` is generated, ImageCleaner will continuously delete all the images in the list from node VMs.
77
+
Once an `ImageList` is generated, ImageCleaner will remove all the images in the list from node VMs.
80
78
81
79
## Configuration options
82
80
@@ -111,7 +109,21 @@ az aks update -g MyResourceGroup -n MyManagedCluster \
111
109
--image-cleaner-interval-hours 48
112
110
```
113
111
114
-
Based on your configuration, ImageCleaner will generate an `ImageList` containing unreferenced/vulnerable images at the desired interval. ImageCleaner will automatically remove these images from cluster nodes.
112
+
Based on your configuration, ImageCleaner will generate an `ImageList` containing non-running and vulnerable images at the desired interval. ImageCleaner will automatically remove these images from cluster nodes.
113
+
114
+
## Manually remove images
115
+
116
+
To manually remove images from your cluster using ImageCleaner, first create an `ImageList`. For example:
117
+
118
+
```yml
119
+
apiVersion: eraser.sh/v1alpha1
120
+
kind: ImageList
121
+
metadata:
122
+
name: imagelist
123
+
spec:
124
+
images:
125
+
- docker.io/library/alpine:3.7.3 # You can also use "*" to specify all non-running images
126
+
```
115
127
116
128
## Disable ImageCleaner
117
129
@@ -140,4 +152,5 @@ The deletion logs are stored in the `image-cleaner-kind-worker` pods. You can ch
0 commit comments