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
title: Use ImageCleaner on Azure Kubernetes Service (AKS)
3
+
description: Learn how to use ImageCleaner to clean up stale images on Azure Kubernetes Service (AKS)
4
+
ms.author: nickoman
5
+
author: nickomang
6
+
services: container-service
7
+
ms.topic: article
8
+
ms.date: 08/26/2022
9
+
---
10
+
11
+
# Use ImageCleaner to clean up stale images on your Azure Kubernetes Service cluster (preview)
12
+
13
+
It's common to use pipelines to build and deploy images on Azure Kubernetes Service (AKS) clusters. While great for image creation, this process often doesn't account for the stale images left behind and can lead to image bloat on cluster nodes. These images can present security issues as they may contain vulnerabilities. By cleaning these unreferenced images, you can remove an area of risk in your clusters. When done manually, this process can be time intensive, which ImageCleaner can mitigate via automatic image identification and removal.
14
+
15
+
[!INCLUDE [preview features callout](./includes/preview/preview-callout.md)]
16
+
17
+
## Prerequisites
18
+
19
+
* An Azure subscription. If you don't have an Azure subscription, you can create a [free account](https://azure.microsoft.com/free).
20
+
*[Azure CLI][azure-cli-install] or [Azure PowerShell][azure-powershell-install] and the `aks-preview` CLI extension installed.
21
+
* The `EnableImageCleanerPreview` feature flag registered on your subscription:
22
+
23
+
### [Azure CLI](#tab/azure-cli)
24
+
25
+
Register the `EnableImageCleanerPreview` feature flag by using the [az feature register][az-feature-register] command, as shown in the following example:
26
+
27
+
```azurecli-interactive
28
+
az feature register --namespace "Microsoft.ContainerService" --name "EnableImageCleanerPreview"
29
+
```
30
+
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
+
33
+
```azurecli-interactive
34
+
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/EnableImageCleanerPreview')].{Name:name,State:properties.state}"
35
+
```
36
+
37
+
When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [az provider register][az-provider-register] command:
38
+
39
+
```azurecli-interactive
40
+
az provider register --namespace Microsoft.ContainerService
41
+
```
42
+
43
+
### [Azure PowerShell](#tab/azure-powershell)
44
+
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:
When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [Register-AzResourceProvider][register-azresourceprovider] command:
* ARM64 node pools. For more information, see [Azure Virtual Machines with ARM-based processors][arm-vms].
71
+
* Windows node pools.
72
+
73
+
## How ImageCleaner works
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. 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
+
77
+
Once an `ImageList` is generated, ImageCleaner will remove all the images in the list from node VMs.
78
+
79
+
80
+
:::image type="content" source="./media/image-cleaner/image-cleaner.jpg" alt-text="A diagram showing ImageCleaner's workflow. The ImageCleaner pods running on the cluster can generate an ImageList, or manual input can be provided.":::
81
+
82
+
## Configuration options
83
+
84
+
In addition to choosing between manual and automatic mode, there are several options for ImageCleaner:
85
+
86
+
|Name|Description|Required|
87
+
|----|-----------|--------|
88
+
|--enable-image-cleaner|Enable the ImageCleaner feature for an AKS cluster|Yes, unless disable is specified|
89
+
|--disable-image-cleaner|Disable the ImageCleaner feature for an AKS cluster|Yes, unless enable is specified|
90
+
|--image-cleaner-interval-hours|This parameter determines the interval time (in hours) ImageCleaner will use to run. The default value is one week, the minimum value is 24 hours and the maximum is three months.|No|
91
+
92
+
## Enable ImageCleaner on your AKS cluster
93
+
94
+
To create a new AKS cluster using the default interval, use [az aks create][az-aks-create]:
95
+
96
+
```azurecli-interactive
97
+
az aks create -g MyResourceGroup -n MyManagedCluster \
98
+
--enable-image-cleaner
99
+
```
100
+
101
+
To enable on an existing AKS cluster, use [az aks update][az-aks-update]:
102
+
103
+
```azurecli-interactive
104
+
az aks update -g MyResourceGroup -n MyManagedCluster \
105
+
--enable-image-cleaner
106
+
```
107
+
108
+
The `--image-cleaner-interval-hours` parameter can be specified at creation time or for an existing cluster. For example, the following command updates the interval for a cluster with ImageCleaner already enabled:
109
+
110
+
```azurecli-interactive
111
+
az aks update -g MyResourceGroup -n MyManagedCluster \
112
+
--image-cleaner-interval-hours 48
113
+
```
114
+
115
+
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.
116
+
117
+
## Manually remove images
118
+
119
+
To manually remove images from your cluster using ImageCleaner, first create an `ImageList`. For example, save the following as `image-list.yml`:
120
+
121
+
```yml
122
+
apiVersion: eraser.sh/v1alpha1
123
+
kind: ImageList
124
+
metadata:
125
+
name: imagelist
126
+
spec:
127
+
images:
128
+
- docker.io/library/alpine:3.7.3 # You can also use "*" to specify all non-running images
129
+
```
130
+
131
+
And apply it to the cluster:
132
+
133
+
```bash
134
+
kubectl apply -f image-list.yml
135
+
```
136
+
137
+
A job will trigger which causes ImageCleaner to remove the desired images from all nodes.
138
+
139
+
## Disable ImageCleaner
140
+
141
+
To stop using ImageCleaner, you can disable it via the `--disable-image-cleaner` flag:
142
+
143
+
```azurecli-interactive
144
+
az aks update -g MyResourceGroup -n MyManagedCluster
145
+
--disable-image-cleaner
146
+
```
147
+
148
+
## Logging
149
+
150
+
The deletion logs are stored in the `image-cleaner-kind-worker` pods. You can check these via `kubectl logs` or via the Container Insights pod log table if the [Azure Monitor add-on](./monitor-aks.md) is enabled.
Azure Cosmos DB API for MongoDB introduced a new data compression algorithm in versions 4.0+ that saves up to 90% on RU and storage costs. Upgrading your database account to versions 4.0+ and following this guide will help you realize the maximum performance and cost improvements.
15
+
16
+
## How it works
17
+
The API for MongoDB charges users based on how many [request units](../request-units.md) (RUs) are consumed for each operation. With the new compression format, a reduction in storage size and query size directly results in a reduction in RU usage, saving you money. Performance and costs are coupled in Cosmos DB.
18
+
19
+
When [upgrading](upgrade-mongodb-version.md) from an API for MongoDB database account versions 3.6 or 3.2 to version 4.0 or greater, all new documents (data) written to that account will be stored in the improved compression format. Older documents, written before the account was upgraded, remain fully backwards compatible, but will remain stored in the older compression format.
20
+
21
+
## Upgrading older documents
22
+
When upgrading your database account to versions 4.0+, it's good idea to consider upgrading your older documents as well. Doing so will provide you with efficiency improvements on your older data as well as new data that gets written to the account after the upgrade. The following steps upgrade your older documents to the new compression format:
23
+
24
+
1.[Upgrade](upgrade-mongodb-version.md) your database account to 4.0 or higher. Any new data that's written to any collection in the account will be written in the new format. All formats are backwards compatible.
25
+
2. Update at least one field in each old document (from before the upgrade) to a new value or change the document in a different way- such as adding a new field. Don't rewrite the exact same document since the Cosmos DB optimizer will ignore it.
26
+
3. Repeat step two for each document. When a document is updated, it will be written in the new format.
27
+
28
+
29
+
## Next steps
30
+
Learn more about upgrading and the API for MongoDB versions:
31
+
*[Introduction to the API for MongoDB](mongodb-introduction.md)
Copy file name to clipboardExpand all lines: articles/cost-management-billing/automate/get-small-usage-datasets-on-demand.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ titleSuffix: Microsoft Cost Management
4
4
description: The article explains how you can use the Cost Details API to get raw, unaggregated cost data that corresponds to your Azure bill.
5
5
author: bandersmsft
6
6
ms.author: banders
7
-
ms.date: 07/15/2022
7
+
ms.date: 09/08/2022
8
8
ms.topic: conceptual
9
9
ms.service: cost-management-billing
10
10
ms.subservice: cost-management
@@ -21,6 +21,14 @@ To learn more about the data in cost details (formerly referred to as *usage det
21
21
22
22
The [Cost Details](/rest/api/cost-management/generate-cost-details-report) report is only available for customers with an Enterprise Agreement or Microsoft Customer Agreement. If you're an MSDN, Pay-As-You-Go or Visual Studio customer, see [Get cost details for a pay-as-you-go subscription](get-usage-details-legacy-customer.md).
23
23
24
+
## Permissions
25
+
26
+
To use the Cost Details API, you need read only permissions for supported features and scopes. For more information, see:
27
+
28
+
-[Azure RBAC scopes - role permissions for feature behavior](../costs/understand-work-scopes.md#feature-behavior-for-each-role)
29
+
-[Enterprise Agreement scopes - role permissions for feature behavior](../costs/understand-work-scopes.md#feature-behavior-for-each-role-1)
30
+
-[Microsoft Customer Agreement scopes - role permissions for feature behavior](../costs/understand-work-scopes.md#feature-behavior-for-each-role-2)
31
+
24
32
## Cost Details API best practices
25
33
26
34
Microsoft recommends the following best practices as you use the Cost Details API.
Copy file name to clipboardExpand all lines: articles/cost-management-billing/costs/understand-work-scopes.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ titleSuffix: Microsoft Cost Management
4
4
description: This article helps you understand billing and resource management scopes available in Azure and how to use the scopes in Cost Management and APIs.
5
5
author: bandersmsft
6
6
ms.author: banders
7
-
ms.date: 12/07/2021
7
+
ms.date: 09/08/2022
8
8
ms.topic: conceptual
9
9
ms.service: cost-management-billing
10
10
ms.subservice: cost-management
@@ -82,7 +82,7 @@ The following table shows how Cost Management features are used by each role. Th
@@ -139,7 +139,7 @@ The following tables show how Cost Management features can be utilized by each r
139
139
140
140
|**Feature/Role**|**Enterprise Admin**|**Enterprise Read Only**|**Department Admin (only if "DA view charges" setting is on)**|**Department Read Only (only if "DA view charges" setting is on)**|
141
141
| --- | --- | --- | --- | --- |
142
-
|**Cost Analysis / Forecast / Query API**| Read only | Read only | Read only | Read only |
142
+
|**Cost Analysis / Forecast / Query / Cost Details API**| Read only | Read only | Read only | Read only |
@@ -150,7 +150,7 @@ The following tables show how Cost Management features can be utilized by each r
150
150
151
151
|**Feature/Role**|**Enterprise Admin**|**Enterprise Read Only**|**Department Admin (only if "DA view charges" is on)**|**Department Read Only (only if "DA view charges" setting is on)**|**Account Owner (only if "AO view charges" setting is on)**|
152
152
| --- | --- | --- | --- | --- | --- |
153
-
|**Cost Analysis / Forecast / Query API**| Read only | Read only | Read only | Read only | Read only |
153
+
|**Cost Analysis / Forecast / Query / Cost Details API**| Read only | Read only | Read only | Read only | Read only |
0 commit comments