From WebUI to CLI: MariaDB in OpenShift


Web base user interfaces are great at walking a user through tasks they do not know how to perform yet. In my case, I want to launch a MariaDB instance on OpenShift. Eventually, I want to do this from the command line. Here are my steps.

To start, I am going to use the web UI to kick off a MariaDB Instance. I already have a new project, called keystone (imagine that?).

I am working as the kube:admin. I should not be doing that.

Here is the topology screen.

Select “From Catalog” to use the predefined MariaDB setup. Scroll down…

…and select the MariaDB option.

and select Initiate Template

I filled out the form with the term Keystone in a bunch of places, including the user and database names. This is for development, not production. Hit submit and see:

Go to the topology tab again:

And use the steps I laid out before to test that you can connect

Now capture the yaml config in a file:

oc get deploymentconfigs mariadb -o yaml > maridb.yaml

And delete the original instance:

$ oc delete deploymentconfigs mariadb deploymentconfig.apps.openshift.io “mariadb” deleted

Now recreate it:

$ oc create -f maridb.yaml deploymentconfig.apps.openshift.io/mariadb created

What you have now is a document that can be included in an Ansible script. Is it sufficient? probably not. You would want to do things like extract the passwords and so on. As you get more advanced, you would want to learn how to create the deploymentconfig from the command line directly. All in good time.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.