Just a quick article to show how to spin up a sql server database on Openshift/Minishift and connect to it.

Initially, we need to Create a new project and import the MS SQL Server image.

Once this is done we:

  1. Create a secret in order to hold the mssql sa password, in this instance we set this to sqladmin1!.
  2. Import the mssql-server-template.yml template which sets up the sql server, and
  3. Create the sql server container from the template

Once the pod is up and running we can forward ports from our machine into the environment with oc.

Once executed oc will forward traffic from localhost to the running sql server pod.

Now we should be able to use a DB tool to connect to the database. In this instance I’m using DBeaver Community Edition

Select SQL Server:

Select SQL Server

Connect with the credentials:

Connect to SQL Server

Browse the database:

Connect to SQL Server

This is also a great way of running up various databases in an Openshift/Minishift environment without installing a database locally. Enjoy!

References


codergists