This section describes how to use YAML to manage existing policies in the following ways:
Change which policy manages a workload
Stop optimization of a workload
Edit or delete a custom policy
There is also a table of common kubectl commands.
Change which policy manages a workload
To change the policy that manages a workload, edit the policy selectors on the current and the desired policy.
Tip
To avoid an unmanaged gap, add the workload to the new policy before removing it from the old policy.
Stop optimization of a workload
To stop optimizing a workload, remove the workload from policy selection, using the relevant solution:
Remove it from the policy’s
appListselector.Update the policy label selector so it no longer matches the workload.
Remove the policy annotation from the workload.
After removing, the workload may still be managed if it matches a different policy.
Edit or delete a custom policy
When you edit policy parameters, those changes will affect future orchestrations. Running workloads will not be affected until the next orchestration.
You can delete a custom policy only if it is not assigned to any active workloads.
If you attempt to delete a custom policy that is assigned to workloads, the delete operation is blocked with a validation error. The error indicates how many workloads are still assigned to the policy and provides a way to view which workloads they are.
To edit or delete a policy, update the policy YAML in the cluster.
Common kubectl commands
Replace the values inside [ ] with your values.
CRDs
Pod rightsizing:
policies.rightsizing.kompass.zesty.coReplica optimization:
policies.horizontalscaling.kompass.zesty.co
Annotations
Pod rightsizing:
rightsizing.kompass.zesty.co/policy: <any rightsizing policy>Replica optimization:
horizontalscaling.kompass.zesty.co/policy: <any rightsizing policy>
To do this | Use this command |
|---|---|
List policies |
|
View a policy manifest |
|
Create or update a policy |
|
Add or update the workload policy annotation |
|
Remove the workload policy annotation |
|
Delete a custom policy |
|