Learn how to provision, bind, update, and manage Oracle Autonomous Container Databases (ACDs) with the Oracle Database Operator for Kubernetes on Dedicated Exadata Infrastructure.
Oracle Database Operator for Kubernetes (OraOperator) includes the Oracle Autonomous Container Database Controller. Autonomous Container Database is one of the resources of the Oracle Autonomous Database on 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 that your system meets all of the Oracle Autonomous Database (ADB) Prerequisites ADB_PREREQUISITES.
As indicated in the prerequisites, to interact with OCI services, the cluster must be authorized either with an Instance Principal, or by using API key authentication and specifying both the configMap and the secret under the ociConfig field.
An administrator must grant the operator required access in a policy to manage Autonomous Container Databases. See Create an Autonomous Container Database for the required policies.
Permission to view work requests is also required so the operator can update resources when work is complete. See Viewing Work Requests for example 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
OCIDof the compartment. -
Get the
AutonomousExadataVMCluster OCID.Login Cloud Console. Go to
Autonomous Database, and click theAutonomous Exadata VM Clusterunder 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
.yamlfile is available here:config/samples/acd/autonomouscontainerdatabase_create.yamlAttribute Type Description Required? spec.compartmentOCIDstring The OCID of the compartment of the Autonomous Container Database. Yes spec.autonomousExadataVMClusterOCIDstring The OCID of the Autonomous Exadata Infrastructure. Yes spec.displayNamestring The user-friendly name for the Autonomous Container Database. The name does not have to be unique. Yes spec.patchModelstring 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.freeformTagsdictionary 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: value2No spec.ociConfigdictionary 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.configMapNamestring Name of the ConfigMap that holds the local OCI configuration Conditional spec.ociConfig.secretNamestring 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
Instead of provisioning a new 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 OCIDfrom Cloud Console. -
Add the following fields to the AutonomousContainerDatabase resource definition. An example
.yamlfile is available here:config/samples/acd/autonomouscontainerdatabase_bind.yamlAttribute Type Description Required? spec.autonomousContainerDatabaseOCIDstring The OCID of the Autonomous Container Database you want to bind (create a reference) in your cluster. Yes spec.ociConfigdictionary 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.configMapNamestring Name of the ConfigMap that holds the local OCI configuration Conditional spec.ociConfig.secretNamestring 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 file.
kubectl apply -f config/samples/acd/autonomouscontainerdatabase_bind.yaml autonomouscontainerdatabase.database.oracle.com/autonomouscontainerdatabase-sample created
Note: this operation requires an
AutonomousContainerDatabaseobject 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
AutonomousContainerDatabaseobject 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 or terminate a database using the action attribute. The value will be erased after the change is applied.
The following is a list of the values that you can set for action:
RESTART: to restart the databaseTERMINATE: to terminate the databaseSYNC: to sync the local database with the remote one
-
An example 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
AutonomousContainerDatabaseobject 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
hardLinkto 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.






