integrate openshift with cloudforms

23
INTEGRATE OPENSHIFT WITH CLOUDFORMS 4 Technical presentation Michael Lessard Senior Solutions Architect February 2016

Upload: michael-lessard

Post on 23-Feb-2017

1.155 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Integrate Openshift with Cloudforms

INTEGRATE OPENSHIFT WITH CLOUDFORMS 4Technical presentation

Michael LessardSenior Solutions ArchitectFebruary 2016

Page 2: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Agenda

2

● Demonstration● Install and configure Cloudforms 4

○ Add Openshift 3.1 as a container provider

● Getting the metrics in Cloudforms ○ Configure Hawkular (Openshift doc way)○ Modify the Hawkular config

Page 3: Integrate Openshift with Cloudforms

LET’S START WITH THE DEMO

Page 4: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

My Openshift setup

4

● Openshift domain : os3.mlc.dom● Openshift app domain : app.os3.mlc.dom

Page 5: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Requirements

5

● Virtual machine, 40Gig of space, 4 Gig of ram ● Openshift 3.1.1 installed ● Cloudforms 4 image downloaded (cfme-rhos-5.5.2.4-1.x86_64.

qcow2)

Page 6: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Page 7: Integrate Openshift with Cloudforms

CONFIGURE CLOUDFORMS 4

Page 8: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Configure Cloudforms 4 - Part 1

8

1. Launch a new vm, use an existing image (4 gig of RAM is sufficient)2. Login as root:smartvm 3. Configure the cloudforms appliance (# appliance_console)

a. assign an ip and hostnameb. Configure timezonec. configure the database, do not need to use an external partition

4. Connect to the web interface. Username : admin, passwd : smartvm5. Configure - Configuration, activate all roles except database synchro

and RHN mirror + configure the timezone (again)6. Reboot the appliance

Page 9: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Configure Cloudforms 4 - Part 2Add Openshift as a container provider

ON YOUR OPENSHIFT VM, RETRIEVE AN ADMIN KEY# oc login -u system:admin -n default# oc get -n management-infra sa/management-admin --template='{{range .secrets}}{{printf "%s\n" .name}}{{end}}'management-admin-token-2g4ivmanagement-admin-dockercfg-02kl4management-admin-token-5xqyo# oc get -n management-infra secrets management-admin-token-2g4iv --template='{{.data.token}}' | base64 -d > key.txt

9

Copy the key

https://access.redhat.com/documentation/en/red-hat-cloudforms/version-4.0/managing-providers/#configuring_service_accounts

Page 10: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Configure Cloudforms 4 - Part 3

10

1. Login into the CF4 interface 2. Containers - Provider - Configuration - Add New containers provider3. Put a name and select in type Openshift 4. Put the hostname and port 8443 5. Past the key then click validate 6. Et voilà :)

Add Openshift as a container provider

Page 11: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Page 12: Integrate Openshift with Cloudforms

GETTING THE METRICS IN CLOUDFORMS 4

Page 13: Integrate Openshift with Cloudforms

CONFIGURE HAWKULAR PART 1(Openshift doc way)

Page 14: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Configure Hawkular - Part 1Create the service account

# oc project openshift-infra (should be there by default)

# oc create -f - <<APIapiVersion: v1kind: ServiceAccountmetadata: name: metrics-deployersecrets:- name: metrics-deployerAPI

14

Page 15: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Configure Hawkular - Part 2 ADD ROLES TO SOME SERVICE ACCOUNT# oadm policy add-role-to-user edit system:serviceaccount:openshift-infra:metrics-deployer# oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:openshift-infra:heapster

CREATES A SUPER SECURE SECRET# oc secrets new metrics-deployer nothing=/dev/null

COPY THE TEMPLATE# cp /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v1.1/infrastructure-templates/enterprise/metrics-deployer.yaml /root/metrics.yaml

15

Page 16: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Configure Hawkular - Part 3# cd /root/ # oc process -f metrics.yaml -v \HAWKULAR_METRICS_HOSTNAME=metrics.app.os3.mlc.dom,USE_PERSISTENT_STORAGE=false,IMAGE_PREFIX=openshift3/,IMAGE_VERSION=latest \| oc create -f - *** a reboot might be required … and wait … oc get pods is your friend

# vi /etc/origin/master/master-config.yamlassetConfig: ..... metricsPublicURL: https://metrics.app.os3.mlc.dom/hawkular/metrics

# systemctl restart atomic-openshift-master

16

Using a webbrowser, validate that Hawkular is started

Page 17: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Page 18: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Page 19: Integrate Openshift with Cloudforms

MODIFY HAWKULAR CONFIGURATIONTO MAKE IT WORKS WITH CF4

Page 20: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Router for CF - map port 5000At the moment a limitation in CloudForms Management Engine is assuming that the provider Hostname is used also to collect the metrics.

Create an openshift router to give access to the metric information for Cloudforms

# oadm router management-metrics -n default --credentials=/etc/origin/master/openshift-router.kubeconfig --service-account=router --ports='443:5000' --selector='kubernetes.io/hostname=os3.mlc.dom' --stats-port=1937 --host-network=false

20

Page 21: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Modify the route config + OS3 config

# oc project openshift-infra# oc edit route

hosts: os3.mlc.dom

# vi /etc/origin/master/master-config.yamlassetConfig: ..... masterPublicURL: https://os3.mlc.dom:8443 metricsPublicURL: https://os3.mlc.dom:5000/hawkular/metrics

# systemctl restart atomic-openshift-master

21

Page 22: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3

Page 23: Integrate Openshift with Cloudforms

Cloudforms 4 :: Openshift 3