Before you get started we recommend reading the following tips. They explain a bit about how the playground environment is setup and what access you have.
Logging in to the Cluster
When the OpenShift playground is created you will be logged in initially as a cluster admin on the command line. This will allow you to perform operations which would normally be performed by a cluster admin.
Before creating any applications, it is recommended you login as a distinct user. This will be required if you want to log in to the web console and use it.
To login to the OpenShift cluster from the Terminal run:
oc login -u developer -p developer
This will log you in using the credentials:
Use the same credentials to log into the web console.
In order that you can still run commands from the command line as a cluster
sudoer role has been enabled for the
To execute a command as a cluster admin use the
--as system:admin option
to the command. For example:
oc get projects --as system:admin
Creating your own Project
To create a new project called
myproject run the command:
oc new-project myproject
You could instead create the project from the web console. If you do this, to change to the project from the command line run the command:
oc project myproject
Persistent Volume Claims
Persistent volumes have been pre-created in the playground environment. These will be used if you make persistent volume claims for an application. The volume sizes are defined as 10Gi each, however you are limited by how much disk space the host running the OpenShift environment has, which is much less.
To view the list of available persistent volumes you can run:
oc get pv --as system:admin
Builder Images and Templates
You can see the list of what is available, and what versions, under Add to Project in the web console, or by running from the command line:
oc new-app -L
Running Images as a Defined User
By default OpenShift prohibits images from running as the
or as a specified user. Instead, each project is assigned its own unique
range of user IDs that application images have to run as.
If you attempt to run an arbitrary image from an external image registry
such a Docker Hub, which is not built to best practices, or requires that
it be run as
root, it may not work as a result.
In order to run such an image, you will need to grant additional privileges to the project you create to allow it to run an application image as any user ID. This can be done by running the command:
oc adm policy add-scc-to-user anyuid -z default -n myproject --as system:admin