working-with-rules
Summary and Key concepts
Summary:
This article explains how to create, update, monitor, and delete AutopilotRule
objects, which are used to define automation rules for Portworx's Autopilot feature in Kubernetes and OpenShift. The AutopilotRule
CRD allows users to specify objects to monitor, conditions to track, and actions to execute when conditions are met (e.g., resizing PVCs). The article provides step-by-step instructions on creating AutopilotRule
specs, applying them in the cluster, and viewing the associated events to monitor their status. It also covers how to modify or delete existing rules.
Kubernetes Concepts:
- Custom Resource Definition (CRD): Allows users to create custom resources, such as
AutopilotRule
, to extend Kubernetes functionality. - Labels and Selectors: Labels are key-value pairs attached to objects, and selectors are used to match labels in the
AutopilotRule
to choose which objects to monitor.
Portworx Concepts:
- Autopilot: A feature in Portworx that automates storage management tasks based on defined rules.
Understanding an AutopilotRule
Users use an AutopilotRule CRD to tell Autopilot which objects to monitor, the conditions to monitor, and the corresponding actions to perform when conditions occur.
An AutopilotRule has 4 main parts:
- Selector Matches labels on the objects that the rule should monitor.
- Namespace Selector Matches labels on the Kubernetes namespaces the rule should monitor. This is optional, and the default is all namespaces.
- Conditions The metrics for the objects to monitor.
- Actions to perform once the metric conditions are met.
The subsequent sections describe common operations for managing these rules.