Create a MySQL service
Apply the following object on your namespace, as specified by its YAML description.
Example to create a MySQL instance
apiVersion: exoscale.appcat.vshn.io/v1
kind: ExoscaleMySQL
metadata:
name: my-mysql-example (1)
namespace: my-namespace (2)
spec:
parameters:
backup:
timeOfDay: "12:00:00" (3)
service:
zone: ch-dk-2 (4)
majorVersion: "8" (5)
mysqlSettings:
default_time_zone: "+01:00" (6)
size:
plan: hobbyist-2 (7)
writeConnectionSecretToRef:
name: mysql-creds (8)
1 | Instance name |
2 | The namespace where the object will be created |
3 | Specify backup time of day |
4 | The Exoscale zone to use, see list of regions |
5 | MySQL version |
6 | Specify custom MySQL settings [optional] |
7 | See reference for a list of plans |
8 | 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 |
Inspect your new MySQL service
$ oc get exoscalemysql
NAMESPACE NAME PLAN ZONE READY CONNECTION-SECRET AGE
my-namespace my-mysql-example hobbyist-2 ch-dk-2 True mysql-creds 5m
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 mysql-creds -o yaml
The output of the command above is a secret specification with the following structure:
apiVersion: v1
kind: Secret
metadata:
name: mysql-creds
stringData:
MYSQL_DB: defaultdb (1)
MYSQL_HOST: my-mysql.my-cloud.com (2)
MYSQL_PASSWORD: my-secret (3)
MYSQL_PORT: 21699 (4)
MYSQL_URL: mysql://superuser:my-secret@my-mysql.my-cloud.com:21699/defaultdb?ssl-mode=REQUIRED (5)
MYSQL_USER: superuser (6)
ca.crt: | (7)
-----BEGIN CERTIFICATE-----
HexValues
-----END CERTIFICATE-----
1 | Database name |
2 | Host to connect to |
3 | Password |
4 | Port |
5 | URL containing all necessary information to connect to the instance |
6 | Username |
7 | ca.crt to use when using ssl-mode=VERIFY-CA |
Not all fields apply to all providers |