This directory contains example JSON templates to deploy databases in OpenShift. They can be used to immediately instantiate a database and expose it as a service in the current project, or to add a template that can be later used from the Web Console or the CLI.
The examples can also be tweaked to create new templates.
For each supported database, there are two template files.
Files named *-ephemeral-template.json
use
"emptyDir" volumes
for data storage, which means that data is lost after a pod restart.
This is tolerable for experimenting, but not suitable for production use.
The other templates, named *-persistent-template.json
, use persistent volume
claims
to request persistent storage provided by persistent
volumes,
that must have been created upfront.
Use these instructions if you want to quickly deploy a new database service in your current project. Instantiate a new database service with this command:
$ oc new-app /path/to/template.json
Replace /path/to/template.json
with an appropriate path, that can be either a
local path or an URL. Example:
$ oc new-app https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mariadb-ephemeral-template.json
The parameters listed in the output above can be tweaked by specifying values in
the command line with the -p
option:
$ oc new-app examples/db-templates/mariadb-ephemeral-template.json -p DATABASE_SERVICE_NAME=mydb -p MYSQL_USER=default
Note that the persistent template requires an existing persistent volume, otherwise the deployment won't ever succeed.
Use these instructions if, instead of instantiating a service right away, you want to load the template into an OpenShift project so that it can be used later. Create the template with this command:
$ oc create -f /path/to/template.json
Replace /path/to/template.json
with an appropriate path, that can be either a
local path or an URL. Example:
$ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/mariadb-ephemeral-template.json
template "mariadb-ephemeral" created
The new template is now available to use in the Web Console or with oc new-app
.
- MariaDB - For more information see the product documentation.
- MariaDB Persistent - For more information see the product documentation.
- MySQL - For more information see the product documentation.
- MySQL Persistent - For more information see the product documentation.
- PostgreSQL - For more information see the product documentation.
- PostgreSQL Persistent - For more information see the product documentation.
- Redis - For more information see the image documentation.
- Redis Persistent - For more information see the image documentation.
Note: This file is processed by hack/update-external-examples.sh
. New examples
must follow the exact syntax of the existing entries. Files in this directory
are automatically pulled down, do not modify/add files to this directory.