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/kubernetes-fleet/cluster-resource-override.md
+47-2Lines changed: 47 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,9 @@ rules:
178
178
179
179
`jsonPatchOverrides`apply a JSON patch on the selected resources following [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902).
180
180
181
-
## Apply the cluster resource override
181
+
## Apply the cluster resource placement
182
+
183
+
### [Azure CLI](#tab/azure-cli)
182
184
183
185
1. Create a `ClusterResourcePlacement` resource to specify the placement rules for distributing the cluster resource overrides across the cluster infrastructure, as shown in the following example. Make sure you select the appropriate resource.
184
186
@@ -245,9 +247,52 @@ rules:
245
247
Type: Overridden
246
248
...
247
249
```
248
-
250
+
249
251
The `ClusterResourcePlacementOverridden` condition indicates whether the resource override was successfully applied to the selected resources in the clusters. Each cluster maintains its own `Applicable Cluster Resource Overrides` list, which contains the cluster resource override snapshot if relevant. Individual status messages for each cluster indicate whether the override rules were successfully applied.
250
252
253
+
### [Portal](#tab/azure-portal)
254
+
255
+
1. On the Azure portal overview page for your Fleet resource, in the **Fleet Resources** section, select **Resource placements**.
256
+
257
+
1. Select **Create**.
258
+
259
+
1. Create a `ClusterResourcePlacement` resource to specify the placement rules for distributing the cluster resource overrides across the cluster infrastructure, as shown in the following example. Make sure you select the appropriate resource. Replace the default template with the YAML example below, and select **Add**.
260
+
261
+
:::image type="content" source="./media/cluster-resource-override/crp-create-inline.png" lightbox="./media/cluster-resource-override/crp-create.png" alt-text="A screenshot of the Azure portal page for creating a resource placement, showing the YAML template with placeholder values.":::
262
+
263
+
```yaml
264
+
apiVersion: placement.kubernetes-fleet.io/v1beta1
265
+
kind: ClusterResourcePlacement
266
+
metadata:
267
+
name: crp
268
+
spec:
269
+
resourceSelectors:
270
+
- group: rbac.authorization.k8s.io
271
+
kind: ClusterRole
272
+
version: v1
273
+
name: secret-reader
274
+
policy:
275
+
placementType: PickAll
276
+
affinity:
277
+
clusterAffinity:
278
+
requiredDuringSchedulingIgnoredDuringExecution:
279
+
clusterSelectorTerms:
280
+
- labelSelector:
281
+
matchLabels:
282
+
env: prod
283
+
```
284
+
285
+
This example distributes resources across all clusters labeled with `env: prod`. As the changes are implemented, the corresponding `ClusterResourceOverride` configurations will be applied to the designated clusters, triggered by the selection of matching cluster role resource, `secret-reader`.
286
+
287
+
288
+
1. Verify that the cluster resource placement is created successfully.
289
+
290
+
:::image type="content" source="./media/cluster-resource-override/crp-success-inline.png" lightbox="./media/cluster-resource-override/crp-success.png" alt-text="A screenshot of the Azure portal page for cluster resource placements, showing a successfully created cluster resource placement.":::
291
+
292
+
1. Verify the cluster resource placement applied to the selected resources by selecting the resource from the list and checking the status.
293
+
294
+
---
295
+
251
296
## Next steps
252
297
253
298
To learn more about Fleet, see the following resources:
This article discusses creating cluster resource placements, which can be done via Azure CLI or the Azure portal. For more, see [Propagate resources from a Fleet hub cluster to member clusters](./quickstart-resource-propagation.md).
27
+
26
28
## Prerequisites
27
29
28
30
* Read the [resource propagation conceptual overview](./concepts-resource-propagation.md) to understand the concepts and terminology used in this quickstart.
@@ -225,15 +227,28 @@ spec:
225
227
226
228
In this example, a cluster would only receive extra weight if it has the label `env=prod`. If it satisfies that label based constraint, then the cluster is given proportional weight based on the amount of total CPU in that member cluster.
227
229
228
-
229
230
## Clean up resources
230
231
231
-
If you no longer wish to use the `ClusterResourcePlacement` objects created in this article, you can delete them using the `kubectl delete` command. For example:
232
+
### [Azure CLI](#tab/azure-cli)
233
+
234
+
If you no longer wish to use the `ClusterResourcePlacement` object, you can delete it using the `kubectl delete` command. The following example deletes the `ClusterResourcePlacement` object named `crp`:
0 commit comments