- Overview
- Getting Started
- Installing Metrics
- Intalling Logging Aggregation
- Administrator Access
- Retaining State Of Your Cluster
NOTE |
---|
This command was released with the 1.3+ version of oc client tools, so you must be using version 1.3+ or newer for this command to work. |
The oc cluster up
command starts a local OpenShift all-in-one cluster with a configured registry, router, image streams, and default templates.
By default, the command requires a working Docker connection. However, if running in an environment with
Docker Machine installed, it can create a Docker machine for you.
The oc cluster up
command will create a default user and project and, once it completes, will allow you to start using the
command line to create and deploy apps with commands like oc new-app
, oc new-build
, and oc run
. It will also print out
a URL to access the management console for your cluster.
-
Install Docker for Mac making sure you meet the prerequisites.
-
Once Docker is running, add an insecure registry of
172.30.0.0/16
:- From the Docker menu in the toolbar, select
Preferences...
- Click on
Advanced
in the preferences dialog - Under
Insecure registries:
, click on the+
icon to add a new entry - Enter
172.30.0.0/16
and pressreturn
- Click on
Apply and Restart
- From the Docker menu in the toolbar, select
-
Install
socat
- If not already installed, install Homebrew for Mac
- Install socat
Open Terminal and run:
$ brew install socat
-
Install the oc binary using homebrew with:
brew install openshift-cli
OR
Download the Mac OS
oc
binary from openshift-origin-client-tools-VERSION-mac.zip and place it in your path.Please be aware that the 'oc cluster' set of commands are only available in the 1.3+ or newer releases.
-
Open Terminal and run
$ oc cluster up
To stop your cluster, run:
$ oc cluster down
-
Install Docker for Windows making sure you meet the prerequisites.
-
Once Docker is running, add an insecure registry of
172.30.0.0/16
:- Right click on the Docker icon in the notification area and select
Settings...
- Click on
Docker Daemon
in the settings dialog - Edit the Docker daemon configuration by adding
"172.30.0.0/16"
to the"insecure-registries":
setting{ "registry-mirrors": [], "insecure-registries": [ "172.30.0.0/16" ] }
- Click on
Apply
and Docker will restart
- Right click on the Docker icon in the notification area and select
-
Download the Windows
oc.exe
binary from openshift-origin-client-tools-VERSION-windows.zip and place it in your path.Please be aware that the 'oc cluster' set of commands are only available in the 1.3+ or newer releases.
-
Open a Command window as Administrator and run:
C:\> oc cluster up
To stop the cluster, run:
C:\> oc cluster down
-
Install Docker Toolbox and ensure that it is functional.
-
Download the Windows
oc.exe
binary from openshift-origin-client-tools-VERSION-windows.zip and place it in your path.Please be aware that the 'oc cluster' set of commands are only available in the 1.3+ or newer releases.
-
Open a Command window as Administrator (for most drivers, docker-machine on Windows requires administrator privileges) and run:
C:\> oc cluster up --create-machine
A Docker machine named openshift
will be created using the VirtualBox driver and the OpenShift cluster
will be started on it.
To stop the cluster, run:
C:\> oc cluster down --docker-machine=openshift
To create a machine with a different name, specify the --docker-machine
argument with --create-machine
:
C:\> oc cluster up --create-machine --docker-machine=mymachine
Once the machine has been created, the --create-machine
argument is no longer needed. To start/stop OpenShift again, either:
-
Setup the Docker environment for the machine you wish to use, and then run
oc cluster up
andoc cluster down
:C:\> @FOR /f "tokens=*" %i IN ('docker-machine env openshift') DO @%i C:\> oc cluster up ... C:\> oc cluster down
-
Specify the Docker machine name as an argument to
oc cluster up
andoc cluster down
:C:\> oc cluster up --docker-machine=openshift ... C:\> oc cluster down --docker-machine=openshift
You can install metrics components by specifying the --metrics argument when invoking oc cluster up
.
To see metrics in the web console, you must first browse to the Hawkular metrics UI URL displayed when cluster up
starts.
NOTE |
---|
This feature requires an oc command v1.4 or newer |
You can install logging aggregation components by specifying the --logging argument when invoking oc cluster up
.
With logging aggregation installed, a new link will appear in the logs tab of a running pod in the web console.
To login as administrator to your cluster, login as system:admin
:
oc login -u system:admin
Cluster administration commands are available under oc adm
To return to the regular developer
user, login as that user:
oc login -u developer
While running oc cluster up
you can provide additional parameters to specify OpenShift image and version you want to use as well as the configuration and etc data you want to use. In this way everytime you start your cluster using the same image, version, config and etc data location, all your state of OpenShift cluster is retained.
$ oc cluster up --image=registry.access.redhat.com/openshift3/ose --version=v3.4.1.5-2 --host-data-dir=/Users/macbook/occlusterdata/hostadata --host-config-dir=/Users/macbook/occlusterdata/hostconfig
You can read additional info about these parameters below
oc cluster up
creates its configuration by default in /var/lib/origin/openshift.local.config
on the Docker host.
To specify a different location for it, use the --host-config-dir
argument. The host directory will be mounted
in the origin
container at /var/lib/origin/openshift.local.config
.
A new configuration will be generated by default each time the cluster is started. To make changes to the configuration and
preserve those changes, use the --use-existing-config
argument when starting your cluster.
If your client is not the Docker host, you can make a local copy of the configuration with Docker cp:
docker cp origin:/var/lib/origin/openshift.local.config .
To persist data across restarts, specify a valid host directory in the --host-data-dir
argument when starting your cluster
with oc cluster up
. As long as the same value is specified every time, the data will be preserved across restarts.
If a host data directory is not specified, the data directory used by OpenShift is discarded when the container is destroyed.
The default routing suffix used by oc cluster up
is CLUSTER_IP.xip.io where CLUSTER_IP is the IP address of your cluster.
To use a different suffix, specify it with --routing-suffix
.
By default oc cluster up
uses openshift/origin:[released-version]
as its OpenShift image (where [released-version]
corresponds to the release of the oc
client) and openshift-origin-${component}:[released-version]
for
other images created by the OpenShift cluster (registry, router, builders, etc). It is possible to use a different set of
images by specifying the version and/or the image prefix.
To use a different version of Origin, specify the --version argument. In the following example, images named openshift/origin:v1.1.6, openshift/origin-router:v1.1.6, etc. will be used for your cluster.
oc cluster up --version=v1.1.6
To use images from a different registry or with a different namespace, use the --image argument. In the following example, myregistry.example.com/ose/origin:latest, myregistry.example.com/ose/origin-router:latest, etc. will be used for your cluster.
oc cluster up --image=myregistry.example.com/ose/origin
Both --version and --image may be combined to specify the image name prefix and tag for the images to use.