Create a MariaDB service
Apply the following object on your namespace, as specified by its YAML description.
Example to create a MariaDB instance
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
metadata:
name: mariadb-app1-prod (1)
namespace: prod-app (2)
spec:
parameters:
service:
version: "11.8" (3)
mariadbSettings: | (4)
slow_query_log=1
size: (5)
plan: standard-2
writeConnectionSecretToRef:
name: mariadb-creds (6)
| 1 | Instance name |
| 2 | The namespace where the object will be created |
| 3 | MariaDB version |
| 4 | MariaDB configuration options defined in the [mysqld] section (optional) |
| 5 | Size of the MariaDB instance. See Plans and Sizing for more information |
| 6 | Secret where the connection details are provisioned. This secret shouldn’t exist before creation. |
| To get more information about all available configuration options, please see the API Reference |
| Default database collation is utf8mb4_unicode_ci |
Inspect your new MariaDB service
$ oc get vshnmariadb.vshn.appcat.vshn.io
NAME SYNCED READY CONNECTION-SECRET AGE
mariadb-app1-prod True True mariadb-creds 3m32s
When you see True in the READY column, it means the instance is provisioned and ready to use.
Find the connection details
The connection details are stored in a secret. You can retrieve them with the following command:
$ oc get secrets mariadb-creds -o yaml
The output of the command above is a secret specification with the following structure:
apiVersion: v1
kind: Secret
metadata:
name: mariadb-creds
stringData:
MARIADB_HOST: my-mariadb.my-cloud.com (1)
MARIADB_PASSWORD: my-secret (2)
MARIADB_PORT: 3306 (3)
MARIADB_URL: mysql://superuser:my-secret@my-mariadb.my-cloud.com:3306?ssl-mode=VERIFY-CA (4)
MARIADB_USERNAME: superuser (5)
ca.crt: | (6)
-----BEGIN CERTIFICATE-----
HexValues
-----END CERTIFICATE-----
| 1 | Host to connect to |
| 2 | Password |
| 3 | Port |
| 4 | URL containing all necessary information to connect to the instance |
| 5 | Username |
| 6 | ca.crt to use when using ssl-mode=VERIFY-CA |
| Not all fields apply to all providers |