Date post: | 23-Feb-2017 |
Category: |
Technology |
Upload: | michael-lessard |
View: | 1,146 times |
Download: | 0 times |
INTEGRATE OPENSHIFT WITH CLOUDFORMS 4Technical presentation
Michael LessardSenior Solutions ArchitectFebruary 2016
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
LET’S START WITH THE DEMO
Cloudforms 4 :: Openshift 3
My Openshift setup
4
● Openshift domain : os3.mlc.dom● Openshift app domain : app.os3.mlc.dom
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)
Cloudforms 4 :: Openshift 3
CONFIGURE CLOUDFORMS 4
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
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
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
Cloudforms 4 :: Openshift 3
GETTING THE METRICS IN CLOUDFORMS 4
CONFIGURE HAWKULAR PART 1(Openshift doc way)
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
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
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
Cloudforms 4 :: Openshift 3
Cloudforms 4 :: Openshift 3
MODIFY HAWKULAR CONFIGURATIONTO MAKE IT WORKS WITH CF4
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
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
Cloudforms 4 :: Openshift 3
Cloudforms 4 :: Openshift 3