You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
New to KubeDB? Please start here.
PerconaXtraDBOpsRequest
What is PerconaXtraDBOpsRequest
PerconaXtraDBOpsRequest is a Kubernetes Custom Resource Definitions (CRD). It provides a declarative configuration for PerconaXtraDB administrative operations like database version updating, horizontal scaling, vertical scaling etc. in a Kubernetes native way.
PerconaXtraDBOpsRequest CRD Specifications
Like any official Kubernetes resource, a PerconaXtraDBOpsRequest has TypeMeta, ObjectMeta, Spec and Status sections.
Here, some sample PerconaXtraDBOpsRequest CRs for different administrative operations is given below:
Sample PerconaXtraDBOpsRequest for updating database:
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-version-update
namespace: demo
spec:
type: UpdateVersion
databaseRef:
name: sample-pxc
updateVersion:
targetVersion: 8.0.26
status:
conditions:
- lastTransitionTime: "2020-08-25T18:22:38Z"
message: Successfully completed the modification process
observedGeneration: 1
reason: Successful
status: "True"
type: Successful
observedGeneration: 1
phase: Successful
Sample PerconaXtraDBOpsRequest Objects for Horizontal Scaling of database cluster:
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-scale-horizontal
namespace: demo
spec:
type: HorizontalScaling
databaseRef:
name: sample-pxc
horizontalScaling:
member : 5
status:
conditions:
- lastTransitionTime: "2020-08-25T18:22:38Z"
message: Successfully completed the modification process
observedGeneration: 1
reason: Successful
status: "True"
type: Successful
observedGeneration: 1
phase: Successful
Sample PerconaXtraDBOpsRequest Objects for Vertical Scaling of the database cluster:
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-scale-vertical
namespace: demo
spec:
type: VerticalScaling
databaseRef:
name: sample-pxc
verticalScaling:
perconaxtradb:
requests:
memory: "600Mi"
cpu: "0.1"
limits:
memory: "600Mi"
cpu: "0.1"
status:
conditions:
- lastTransitionTime: "2020-08-25T18:22:38Z"
message: Successfully completed the modification process
observedGeneration: 1
reason: Successful
status: "True"
type: Successful
observedGeneration: 1
phase: Successful
Sample PerconaXtraDBOpsRequest Objects for Reconfiguring PerconaXtraDB Database:
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-reconfigure
namespace: demo
spec:
type: Reconfigure
databaseRef:
name: sample-pxc
configuration:
inlineConfig: |
max_connections = 300
read_buffer_size = 1234567
status:
conditions:
- lastTransitionTime: "2020-08-25T18:22:38Z"
message: Successfully completed the modification process
observedGeneration: 1
reason: Successful
status: "True"
type: Successful
observedGeneration: 1
phase: Successful
Sample PerconaXtraDBOpsRequest Objects for Volume Expansion of PerconaXtraDB:
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-volume-expansion
namespace: demo
spec:
type: VolumeExpansion
databaseRef:
name: sample-pxc
volumeExpansion:
mode: "Online"
perconaxtradb: 2Gi
status:
conditions:
- lastTransitionTime: "2020-08-25T18:22:38Z"
message: Successfully completed the modification process
observedGeneration: 1
reason: Successful
status: "True"
type: Successful
observedGeneration: 1
phase: Successful
Sample PerconaXtraDBOpsRequest Objects for Reconfiguring TLS of the database:
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-recon-tls-add
namespace: demo
spec:
type: ReconfigureTLS
databaseRef:
name: sample-pxc
tls:
requireSSL: true
issuerRef:
apiGroup: cert-manager.io
kind: Issuer
name: px-issuer
certificates:
- alias: server
subject:
organizations:
- kubedb:server
dnsNames:
- localhost
ipAddresses:
- "127.0.0.1"
apiVersion: ops.kubedb.com/v1alpha1
kind: PerconaXtraDBOpsRequest
metadata:
name: px-recon-tls-rotate
namespace: demo
spec:
type: ReconfigureTLS
databaseRef:
name: sample-pxc
tls:
rotateCertificates: true
Here, we are going to describe the various sections of a PerconaXtraDBOpsRequest crd.
A PerconaXtraDBOpsRequest object has the following fields in the spec section.
spec.databaseRef
spec.databaseRef is a required field that point to the PerconaXtraDB object for which the administrative operations will be performed. This field consists of the following sub-field:
- spec.databaseRef.name : specifies the name of the PerconaXtraDB object.
spec.type
spec.type specifies the kind of operation that will be applied to the database. Currently, the following types of operations are allowed in PerconaXtraDBOpsRequest.
Upgrade/UpdateVersionHorizontalScalingVerticalScalingVolumeExpansionReconfigureReconfigureTLSRestart
You can perform only one type of operation on a single
PerconaXtraDBOpsRequestCR. For example, if you want to update your database and scale up its replica then you have to create two separatePerconaXtraDBOpsRequest. At first, you have to create aPerconaXtraDBOpsRequestfor updating. Once it is completed, then you can create anotherPerconaXtraDBOpsRequestfor scaling. You should not create twoPerconaXtraDBOpsRequestsimultaneously.
spec.updateVersion
If you want to update your PerconaXtraDB version, you have to specify the spec.updateVersion section that specifies the desired version information. This field consists of the following sub-field:
spec.updateVersion.targetVersionrefers to a PerconaXtraDBVersion CR that contains the PerconaXtraDB version information where you want to update.
You can only update between PerconaXtraDB versions. KubeDB does not support downgrade for PerconaXtraDB.
spec.horizontalScaling
If you want to scale-up or scale-down your PerconaXtraDB cluster or different components of it, you have to specify spec.horizontalScaling section. This field consists of the following sub-field:
spec.horizontalScaling.memberindicates the desired number of nodes for PerconaXtraDB cluster after scaling. For example, if your cluster currently has 4 nodes, and you want to add additional 2 nodes then you have to specify 6 inspec.horizontalScaling.memberfield. Similarly, if you want to remove one node from the cluster, you have to specify 3 inspec.horizontalScaling.field.
spec.verticalScaling
spec.verticalScaling is a required field specifying the information of PerconaXtraDB resources like cpu, memory etc that will be scaled. This field consists of the following sub-field:
spec.verticalScaling.perconaxtradbindicates the desired resources for PerconaXtraDB standalone or cluster after scaling.spec.verticalScaling.exporterindicates the desired resources for theexportercontainer.spec.verticalScaling.coordinatorindicates the desired resources for thecoordinatorcontainer.
All of them has the below structure:
requests:
memory: "200Mi"
cpu: "0.1"
limits:
memory: "300Mi"
cpu: "0.2"
Here, when you specify the resource request, the scheduler uses this information to decide which node to place the container of the Pod on and when you specify a resource limit for the container, the kubelet enforces those limits so that the running container is not allowed to use more of that resource than the limit you set. You can found more details from here.
spec.volumeExpansion
To use the volume expansion feature the storage class must support volume expansion
If you want to expand the volume of your PerconaXtraDB standalone or cluster, you have to specify spec.volumeExpansion section. This field consists of the following sub-field:
spec.volumeExpansion.perconaxtradbindicates the desired size for the persistent volume of a PerconaXtraDB.spec.volumeExpansion.modeindicates the mode of volume expansion. It can beonlineorofflinebased on the storage class.
All of them refer to Quantity types of Kubernetes.
Example usage of this field is given below:
spec:
volumeExpansion:
perconaxtradb: "2Gi"
This will expand the volume size of all the perconaxtradb nodes to 2 GB.
spec.configuration
If you want to reconfigure your Running PerconaXtraDB cluster with new custom configuration, you have to specify spec.configuration section. This field consists of the following sub-fields:
configSecretpoints to a secret in the same namespace of a PerconaXtraDB resource, which contains the new custom configurations. If there are any configSecret set before in the database, this secret will replace it.inlineConfigcontains the new custom config as a string which will be merged with the previous configuration.removeCustomConfigreomoves all the custom configs of the PerconaXtraDB server.
spec.tls
If you want to reconfigure the TLS configuration of your database i.e. add TLS, remove TLS, update issuer/cluster issuer or Certificates and rotate the certificates, you have to specify spec.tls section. This field consists of the following sub-field:
spec.tls.issuerRefspecifies the issuer name, kind and api group.spec.tls.certificatesspecifies the certificates. You can learn more about this field from here.spec.tls.rotateCertificatesspecifies that we want to rotate the certificate of this database.spec.tls.removespecifies that we want to remove tls from this database.
PerconaXtraDBOpsRequest Status
.status describes the current state and progress of a PerconaXtraDBOpsRequest operation. It has the following fields:
status.phase
status.phase indicates the overall phase of the operation for this PerconaXtraDBOpsRequest. It can have the following three values:
| Phase | Meaning |
|---|---|
| Successful | KubeDB has successfully performed the operation requested in the PerconaXtraDBOpsRequest |
| Failed | KubeDB has failed the operation requested in the PerconaXtraDBOpsRequest |
| Denied | KubeDB has denied the operation requested in the PerconaXtraDBOpsRequest |
status.observedGeneration
status.observedGeneration shows the most recent generation observed by the PerconaXtraDBOpsRequest controller.
status.conditions
status.conditions is an array that specifies the conditions of different steps of PerconaXtraDBOpsRequest processing. Each condition entry has the following fields:
typesspecifies the type of the condition. PerconaXtraDBOpsRequest has the following types of conditions:
| Type | Meaning |
|---|---|
Progressing | Specifies that the operation is now in the progressing state |
Successful | Specifies such a state that the operation on the database was successful. |
Failed | Specifies such a state that the operation on the database failed. |
ScaleDownCluster | Specifies such a state that the scale down operation of replicaset |
ScaleUpCluster | Specifies such a state that the scale up operation of replicaset |
VolumeExpansion | Specifies such a state that the volume expansion operaton of the database |
Reconfigure | Specifies such a state that the reconfiguration of replicaset nodes |
- The
statusfield is a string, with possible valuesTrue,False, andUnknown.statuswill beTrueif the current transition succeeded.statuswill beFalseif the current transition failed.statuswill beUnknownif the current transition was denied.
- The
messagefield is a human-readable message indicating details about the condition. - The
reasonfield is a unique, one-word, CamelCase reason for the condition’s last transition. - The
lastTransitionTimefield provides a timestamp for when the operation last transitioned from one state to another. - The
observedGenerationshows the most recent condition transition generation observed by the controller.






























