CS Launch MariaDB: Difference between revisions

From Computer Science Wiki
Jump to navigation Jump to search
Carnold (talk | contribs)
No edit summary
Carnold (talk | contribs)
No edit summary
 
Line 106: Line 106:
== Updates ==
== Updates ==
Version updates to your manual deployment will have to be made manually.  If you use the '''lts''' tag <code>mariadb:lts</code> then anytime the pod is restarted then the newest version of the long term support image is pulled and ran.  If you a specific a version number tag, then you will need to manually change the version number to update.
Version updates to your manual deployment will have to be made manually.  If you use the '''lts''' tag <code>mariadb:lts</code> then anytime the pod is restarted then the newest version of the long term support image is pulled and ran.  If you a specific a version number tag, then you will need to manually change the version number to update.
== Accessing ==
* By design, access to your database workload is limited to the internal network between your other workloads
* You can access the database through the command prompt on the running database pod
* You can create another workload with a database client installed
* You can use a web based database client and create an ingress to access it from external hosts.  See: [[HowTo:CS_Launch#Launch_an_App_Using_a_Public_Image]]

Latest revision as of 08:02, 28 October 2025

Introduction

Instructions for deploying a simple MariaDB database service on CS Launch using Docker official images: https://hub.docker.com/u/library

Create Project and Namespace

You will need a project and namespace on CS Launch to deploy your database. See HowTo:CS_Launch for instructions on doing this.

Create Persistence Storage

Your database will need a Persistent Volume Claim to store the data so that it is not lost between restarts.

  • Navigate to your Cluster Dashboard
  • Click on Storage from the menu on the left
  • Click on PersistentVolumeClaims underneath Storage
  • Click on the Create button
  • Fill in Name with a namespace unique name, example: mariadb-pvc
  • Change Request Storage to the size of your storage requirements, example: 1 GiB
  • Click on the Create button

Create Passwords Secret

A secret is a secure way to store your deployments password information.

  • Navigate to your Cluster Dashboard
  • Click on Storage from the menu on the left
  • Click on Secrets underneath Storage
  • Click on the Create button
  • Select the Opaque tile as this type of secret is suited for storing passwords
  • Fill in Name with namespace unique name, example: mariadb-secret
  • Fill in Key with MARIADB_ROOT_PASSWORD
  • Fill in Value with what you want to use as the root password, for example: ChangeMe
  • Fill in additional Keys:
    • MARIADB_DATABASE = test-db
    • MARIADB_USER = test
    • MARIADB_PASSWORD = Insecure
  • Click on the Create button

Create Custom Configurations

You can use a ConfigMap to storage custom configuration options.

  • Navigate to your Cluster Dashboard
  • Click on Storage from the menu on the left
  • Click on ConfigMaps underneath Storage
  • Click on the Create button
  • Fill in Name with namespace unique name, example: mariadb-config
  • Fill in Key with my.cnf
  • Fill in Value with your custom configuration options:
[mariadb]
### Put custom mariadb configurations here
  • Click on the Create button

Create the Deployment

Now you have all the components created, you can create the deployment itself. We will create it as a "Deployment" to make it easier. You can create as a StatefulSet to get a consistent pod name, but it is more work set up initially.

  • Navigate to your Cluster Dashboard
  • Click on Workloads from the menu on the left
  • Click on Deployments underneath Workloads
  • Click on the Create button
  • Fill in Name with the hostname you want other workloads to access the service by, example: mariadb
  • Fill in Container Image with the version of mariadb docker image you want, example: mariadb:lts or use a specific version that you want
  • Click on Add Port or Service button
  • Select Cluster IP from the Service Type drop down list
  • Fill in service Name with a port name example: mariadb
  • Fill in Private Container Port with the database port: 3306
  • Click on Add Variable under Environment Variables
  • Select Secret from the Type drop down list
  • Select mariadb-secret from the Secret drop down list

  • Click on the Deployment tab
  • Click on Scaling and Upgrade Policy under the Deployment tab
  • Select Recreate: kill ALL pods, then start new pods checkbox
    • This tells the cluster to remove pods before restarting because multiple pods can not mount the PVC

  • Click on the Pod tab
  • Click on Storage under the Pod tab
  • Select ConfigMap from the Add Volume drop down list
  • Change VolumeName to configuration
  • Select mariadb-config under the ConfigMap drop down list
  • Select Persistent Volume Claim from the Add Volume drop down list
  • Change VolumeName to data
  • Select mariadb-pvc from the Persistent Volume Claim drop down list

  • Click on container-0 tab
  • Click on Storage under the container-0 tab
  • Select configuration from the Select Volume drop down list
  • Fill in Mount Point with /etc/mysql/conf.d
  • Select data from the Select Volume drop down list
  • Fill in Mount Point with /var/lib/mysql

  • Click on Health Check under the container-0 tab
  • Select Command run inside the container exits with status 0 from the Type drop down list under Readiness Check
  • Change Initial Delay to 30 Sec.
  • Change Timeout to 5 Sec.
  • Fill in Command to run with bash -c 'healthcheck.sh --connect --innodb_initialized'
  • Select Command run inside the container exists with status 0 from the Type drop down list under Liveness Check
  • Change Initial Delay to 120 Sec.
  • Change Timeout to 5 Sec.
  • Fill in Command to run with bash -c 'healthcheck.sh --connect --innodb_initialized'
  • Select Command run inside the container exists with status 0 from the Type drop down list under Startup Check
  • Change Initial Delay to 10 Sec.
  • Change Timeout to 5 Sec.
  • Fill in Command to run with bash -c 'healthcheck.sh --connect --innodb_initialized'
  • Change Failure Threshold to 30

  • Finally, click on the Create button to start your deployment

Updates

Version updates to your manual deployment will have to be made manually. If you use the lts tag mariadb:lts then anytime the pod is restarted then the newest version of the long term support image is pulled and ran. If you a specific a version number tag, then you will need to manually change the version number to update.

Accessing

  • By design, access to your database workload is limited to the internal network between your other workloads
  • You can access the database through the command prompt on the running database pod
  • You can create another workload with a database client installed
  • You can use a web based database client and create an ingress to access it from external hosts. See: HowTo:CS_Launch#Launch_an_App_Using_a_Public_Image