Wednesday, August 31, 2016

OpenShift Cluster Up on Fedora

Looking for a quick way to get an OpenShift Origin instance up and running quickly on your local laptop?  Look no further. 'oc cluster up' is here.  Check out the documentation here which points you here for the actual client bits.  Let's get started.

A quick scan of the environment before running 'oc cluster up' so I know what I'm getting.

$ cat /etc/fedora-release
Fedora release 24 (Twenty Four)

$ docker --version
Docker version 1.10.3, build 1ecb834/1.10.3

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

$ docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

Grab the latest client, untar it, change into the proper directory and get the version.

$ wget

$ tar xzvf openshift-origin-client-tools-v1.3.0-alpha.3-7998ae4-linux-64bit.tar.gz

$ cd openshift-origin-client-tools-v1.3.0-alpha.3-7998ae4-linux-64bit/

$ ./oc version
oc v1.3.0-alpha.3
kubernetes v1.3.0+507d3a7
features: Basic-Auth GSSAPI Kerberos SPNEGO

Start the cluster.

$ ./oc cluster up
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.3.0-alpha.3 image ... 
   Pulling image openshift/origin:v1.3.0-alpha.3
   Pulled 0/3 layers, 3% complete
   Pulled 1/3 layers, 57% complete
   Pulled 2/3 layers, 93% complete
   Pulled 3/3 layers, 100% complete
   Image pull complete
-- Checking Docker daemon configuration ... OK
-- Checking for available ports ... 
   WARNING: Binding DNS on port 8053 instead of 53, which may be not be resolvable from all clients.
-- Checking type of volume mount ... 
   Using nsenter mounter for OpenShift volumes
-- Checking Docker version ... OK
-- Creating host directories ... OK
-- Finding server IP ... 
   Using as the server IP
-- Starting OpenShift container ... 
   Creating initial OpenShift configuration
   Starting OpenShift using container 'origin'
   Waiting for API server to start listening
   OpenShift server started
-- Installing registry ... OK
-- Installing router ... OK
-- Importing image streams ... OK
-- Importing templates ... OK
-- Login to server ... OK
-- Creating initial project "myproject" ... OK
-- Server Information ... 
   OpenShift server started.
   The server is accessible via web console at:
   You are logged in as:
       User:     developer
       Password: developer
   To login as administrator:
       oc login -u system:admin

Have a look at the environment again.

$ docker images
REPOSITORY                                   TAG                 IMAGE ID            CREATED             SIZE          v1.3.0-alpha.3      d4a68c00e564        3 weeks ago         483.5 MB   v1.3.0-alpha.3      98e3a96eb8f8        3 weeks ago         348.9 MB    v1.3.0-alpha.3      15baa67d10d5        3 weeks ago         502.7 MB                   v1.3.0-alpha.3      93fd7655df0d        3 weeks ago         483.5 MB               v1.3.0-alpha.3      1b4bb3233091        3 weeks ago         1.591 MB

$ docker ps

CONTAINER ID        IMAGE                                             COMMAND                  CREATED              STATUS              PORTS               NAMES
c3efa00e9e08        openshift/origin-docker-registry:v1.3.0-alpha.3   "/bin/sh -c 'DOCKER_R"   29 seconds ago       Up 26 seconds                           k8s_registry.493e070d_docker-registry-1-e9ero_default_82f06d76-6fc1-11e6-80ab-3c970ee91ed3_c8d13209
7b3d1ae9364a        openshift/origin-haproxy-router:v1.3.0-alpha.3    "/usr/bin/openshift-r"   32 seconds ago       Up 28 seconds                           k8s_router.ffbb3abd_router-1-szsrv_default_82940708-6fc1-11e6-80ab-3c970ee91ed3_1e53f729
54f287d3ac8c        openshift/origin-pod:v1.3.0-alpha.3               "/pod"                   41 seconds ago       Up 39 seconds                           k8s_POD.e4a40125_docker-registry-1-e9ero_default_82f06d76-6fc1-11e6-80ab-3c970ee91ed3_128e75f1
ca3aa55f8db8        openshift/origin-pod:v1.3.0-alpha.3               "/pod"                   42 seconds ago       Up 40 seconds                           k8s_POD.9039df33_router-1-szsrv_default_82940708-6fc1-11e6-80ab-3c970ee91ed3_9992b574
1326f81e48ee        openshift/origin:v1.3.0-alpha.3                   "/usr/bin/openshift s"   About a minute ago   Up About a minute                       origin

We have a new interface.

$ ip a s veth1a784c0
27: veth1a784c0@if26: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether 5e:f6:3a:9d:35:cb brd ff:ff:ff:ff:ff:ff link-netnsid 2
    inet6 fe80::5cf6:3aff:fe9d:35cb/64 scope link 
       valid_lft forever preferred_lft forever

$ brctl show
bridge name bridge id  STP enabled interfaces
docker0  8000.0242c270a05e no  veth1a784c0
virbr0  8000.000000000000 yes  

Now just use the links provided at the end of the 'oc cluster up' to access the OpenShift environment.

Accept the certificate and log in with the credentials provided.

Now you can start to create projects via the GUI.

Log into the CLI as administrator and see what's there.

$ oc get nodes

NAME            STATUS    AGE   Ready     8m

$ oc get projects

NAME                 DISPLAY NAME         STATUS
default                                   Active
kube-system                               Active
myproject            My Project           Active
oc-cluster-up-test   oc-cluster-up-test   Active
openshift                                 Active
openshift-infra                           Active

I was able to deploy an ephemeral Jenkins application (in the oc-cluster-up-test project above) to do some further testing.  It actually uses for wildcard DNS.  Slick.

This is nuts. How much easier can this get.  BTW, this took around 2 minutes to set up.  When I get finished with it, it's a 'oc cluster down' to stop the cluster!  I work on OpenShift and I haven't tried this before. Shame on me.  Nice work OpenShift team.

No comments:

Post a Comment