Application Group Definition
To define your Kubernetes Application Group and prepare for application data backup, you must first define the Application Group detail and the associated backup recipes.
Define Application Group Detail
-
To define the Application Group Detail using the helm release with Secret Driver, run the following command:
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: standalone-mysql spec: applicationGroupDetail: helmReleases: - helmDriver: releaseNames: Secret - mysql
where,
HelmReleases indicates the Helm release
helmDriver indicates the Helm storage driver
releaseNames indicates Helm releases that makes up the Application Group
-
To define the Application Group Detail using the helm release with the ConfigMap Driver, run the following command (for a MySQL application):
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: standalone-mysql spec: applicationGroupDetail: helmReleases: - helmDriver: ConfigMap releaseNames: - mysql
where,
HelmReleases indicates the Helm release
helmDriver Secret indicates the Helm storage driver
releaseNames indicates Helm releases that make up the Application Group
Define Application Group Detail with Label Selectors
You may also use label selectors to define the Application Group Detail. Label selectors restrict the list of returned objects by their labels. A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
Labels are key/value pairs that are attached to objects, such as pods, and are used to specify identifying attributes of objects. Labels can be used to organize and select subsets of objects, and can be attached to objects on initial definition, or subsequently added and modified. Each object can have a set of key/value labels defined, and each key must be unique for a given object.
-
To define the Application Group Detail using matchLabel with a single condition, run the following command:
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: standalone-mysql spec: applicationGroupDetail: selectors: - matchLabels: app.kubernetes.io/instance: mysql-release
where,
matchLabels provides the map of key/value pairs matching only to a single condition (mysql-release)
-
To define the Application Group Detail using matchLabel with multiple conditions, run the following command:
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: standalone-mysql spec: applicationGroupDetail: selectors: - matchLabels: app.kubernetes.io/instance: mysql-release app.kubernetes.io/name: mysql
where,
matchLabels provides the map of key/value pairs matching to both conditions (labels) mysql-release and mysql
-
To define the Application Group Detail using matchExpression with a single label selector requirement, run the following command:
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: standalone-mysql spec: applicationGroupDetail: selectors: - matchExpressions: - key: app.kubernetes.io/instance operator: In values: - mysql-release - wordpress-release
Note: matchLabels is a map of {key, value} pairs. A single {key, value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". matchExpressions provides a list of label selector requirements. The result of matchLabels and matchExpressions translates to an ‘AND’ condition.
For more information, see Label Selectors.
Application Group Definition for MongoDB Database
To define the Application Group Detail for MongoDB databases using matchLabel, run the following command:
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: mongo namespace: pmongo spec: applicationGroupDetail: selectors: - matchLabels: name: mongo1
Where every related resource is tagged with the label name=mongo1
Application Group Definition for PostgreSQL
To define the Application Group Detail for PostgreSQL using matchLabel, run the following command:
apiVersion: backup.druva.com/v1alpha1 kind: ApplicationGroup metadata: name: post namespace: postdb spec: applicationGroupDetail: selectors: - matchLabels: name: postgresdb
Where every related resource is tagged with the label name=postgresdb
Next Steps
Once you define the Application Group, you can define one or more recipes for each Application Group, which will remain unique to that application. For more information, see Recipe Definition.