Oracle Database Operator for Kubernetes (OraOperator
) includes the Oracle Autonomous Container Database Controller. Autonomous Container Database is one of the resources of Oracle Autonomous Database dedicated Exadata infrastructure feature. You can create multiple Autonomous Container Database resources in a single Autonomous Exadata VM Cluster resource, but you must create at least one before you can create any Autonomous Databases.
Before you use the Oracle Database Operator for Kubernetes (the operator), ensure your system meets all of the Oracle Autonomous Database (ADB) Prerequisites ADB_PREREQUISITES.
As indicated in the prerequisites (see above), to interact with OCI services, either the cluster has to be authorized using Principal Instance, or using the API Key Authentication by specifying the configMap and the secret under the ociConfig
field.
The opeartor must be given the required type of access in a policy written by an administrator to manage the Autonomous Container Databases. See Create an Autonomous Container Database for the required policies.
The permission to view the workrequests is also required, so that the operator will update the resources when the work is done. See Viewing Work Requests for sample work request policies.
After the operator is deployed, choose one of the following operations to create an AutonomousContainerDatabase
custom resource for Oracle Autonomous Container Database in your cluster.
After you create the resource, you can use the operator to perform the following tasks:
- Change the display name of an Autonomous Container Database
- Restart/Terminate an Autonomous Container Database
- Delete the resource from the cluster
Follow the steps to provision an Autonomous Database that will map objects in your cluster.
-
Get the
Compartment OCID
.Login Cloud Console and click
Compartment
.Click on the compartment name where you want to create your database, and copy the
OCID
of the compartment. -
Get the
AutonomousExadataVMCluster OCID
.Login Cloud Console. Go to
Autonomous Database
, and click theAutonomous Exadata VM Cluster
under the Dedicated Infrastructure.Click on the name of the Autonomous Exadata VM Cluster, and copy the
OCID
. -
Add the following fields to the AutonomousContainerDatabase resource definition. An example
.yaml
file is available here:config/samples/acd/autonomouscontainerdatabase_create.yaml
Attribute Type Description Required? spec.compartmentOCID
string The OCID of the compartment of the Autonomous Container Database. Yes spec.autonomousExadataVMClusterOCID
string The OCID of the Autonomous Exadata Infrastructure. Yes spec.displayName
string The user-friendly name for the Autonomous Container Database. The name does not have to be unique. Yes spec.patchModel
string The Database Patch model preference. The following values are valid: RELEASE_UPDATES and RELEASE_UPDATE_REVISIONS. Currently, the Release Update Revision maintenance type is not a selectable option. No spec.freeformTags
dictionary Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tag.
Example:
freeformTags:
key1: value1
key2: value2
No spec.ociConfig
dictionary Not required when the Operator is authorized with Instance Principal. Otherwise, you will need the values from the Authorized with API Key Authentication section. Conditional spec.ociConfig.configMapName
string Name of the ConfigMap that holds the local OCI configuration Conditional spec.ociConfig.secretName
string Name of the K8s Secret that holds the private key value Conditional --- apiVersion: database.oracle.com/v1alpha1 kind: AutonomousContainerDatabase metadata: name: autonomouscontainerdatabase-sample spec: compartmentOCID: ocid1.compartment... OR ocid1.tenancy... autonomousExadataVMClusterOCID: ocid1.autonomousexainfrastructure... displayName: newACD ociConfig: configMapName: oci-cred secretName: oci-privatekey
-
Apply the yaml:
kubectl apply -f config/samples/acd/autonomouscontainerdatabase_create.yaml autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample created
Other than provisioning a container database, you can bind to an existing Autonomous Container Database in your cluster.
-
Clean up the resource you created in the earlier provision operation:
kubectl delete adb/autonomouscontainerdatabase-sample autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample deleted
-
Copy the
Autonomous Container Database OCID
from Cloud Console. -
Add the following fields to the AutonomousContainerDatabase resource definition. An example
.yaml
file is available here:config/samples/acd/autonomouscontainerdatabase_bind.yaml
Attribute Type Description Required? spec.autonomousContainerDatabaseOCID
string The OCID of the Autonomous Container Database you want to bind (create a reference) in your cluster. Yes spec.ociConfig
dictionary Not required when the Operator is authorized with Instance Principal. Otherwise, you will need the values from the Authorized with API Key Authentication section. Conditional spec.ociConfig.configMapName
string Name of the ConfigMap that holds the local OCI configuration Conditional spec.ociConfig.secretName
string Name of the K8s Secret that holds the private key value Conditional --- apiVersion: database.oracle.com/v1alpha1 kind: AutonomousContainerDatabase metadata: name: autonomouscontainerdatabase-sample spec: autonomousContainerDatabaseOCID: ocid1.autonomouscontainerdatabase... ociConfig: configMapName: oci-cred secretName: oci-privatekey
-
Apply the yaml.
kubectl apply -f config/samples/acd/autonomouscontainerdatabase_bind.yaml autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample created
Note: this operation requires an
AutonomousContainerDatabase
object to be in your cluster. This example assumes the provision operation or the bind operation has been completed, and the operator is authorized with API Key Authentication.
You can change the display name of the database by modifying the value of the displayName
, as follows:
-
An example YAML file is available here: config/samples/acd/autonomouscontainerdatabase_change_displayname.yaml
--- apiVersion: database.oracle.com/v1alpha1 kind: AutonomousContainerDatabase metadata: name: autonomouscontainerdatabase-sample spec: compartmentOCID: ocid1.compartment... OR ocid1.tenancy... displayName: RenamedADB ociConfig: configMapName: oci-cred secretName: oci-privatekey
displayNameName
: User-friendly name of the Autonomous Container Database. The name does not have to be unique.
-
Apply the change using
kubectl
.kubectl apply -f config/samples/acd/autonomouscontainerdatabase_change_displayname.yaml autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample configured
Note: this operation requires an
AutonomousContainerDatabase
object to be in your cluster. This example assumes the provision operation or the bind operation has been done by the users and the operator is authorized with API Key Authentication.
Users can restart/terminate a database using the action
attribute. The value will be erased after the change is applied.
Here's a list of the values you can set for action
:
RESTART
: to restart the databaseTERMINATE
: to terminate the databaseSYNC
: to sync the database, will describe in the next section
-
A sample .yaml file is available here: config/samples/acd/autonomouscontainerdatabase_restart_terminate.yaml
--- apiVersion: database.oracle.com/v1alpha1 kind: AutonomousContainerDatabase metadata: name: autonomouscontainerdatabase-sample spec: autonomousContainerDatabaseOCID: ocid1.autonomouscontainerdatabase... # Change the action to "TERMINATE" to terminate the database action: RESTART ociConfig: configMapName: oci-cred secretName: oci-privatekey
-
Apply the change to restart the database.
kubectl apply -f config/samples/acd/autonomouscontainerdatabase_restart_terminate.yaml autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample configured
Note: this operation requires an
AutonomousContainerDatabase
object to be in your cluster. This example assumes the provision operation or the bind operation has been done by the users and the operator is authorized with API Key Authentication.
The hardLink
defines the behavior when the resource is deleted from the cluster. If the hardLink
is set to true, the Operator terminates the Autonomous Container Database in OCI when the resource is removed; otherwise, the Autonomous Container Database remains unchanged. By default the value is false
if it is not explicitly specified.
Follow the steps to delete the resource and terminate the Autonomous Container Database.
-
Use the example autonomouscontainerdatabase_delete_resource.yaml which sets the attribute
hardLink
to true.--- apiVersion: database.oracle.com/v1alpha1 kind: AutonomousContainerDatabase metadata: name: autonomouscontainerdatabase-sample spec: autonomousContainerDatabaseOCID: ocid1.autonomouscontainerdatabase... hardLink: true ociConfig: configMapName: oci-cred secretName: oci-privatekey
-
Apply the yaml
kubectl apply -f config/samples/acd/autonomouscontainerdatabase_delete_resource.yaml autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample configured
-
Delete the resource in your cluster
kubectl delete acd/autonomouscontainerdatabase-sample autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample deleted
Now, you can verify that the Autonomous Container Database is in TERMINATING state.