8. 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 hostname
b. Configure timezone
c. configure the database, do not need to use an external partition
4. Connect to the web interface. Username : admin, passwd : smartvm
5. Configure - Configuration, activate all roles except database synchro
and RHN mirror + configure the timezone (again)
6. Reboot the appliance
9. Cloudforms 4 :: Openshift 3
Configure Cloudforms 4 - Part 2
Add 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 "%sn" .name}}{{end}}'
management-admin-token-2g4iv
management-admin-dockercfg-02kl4
management-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
10. Cloudforms 4 :: Openshift 3
Configure Cloudforms 4 - Part 3
10
1. Login into the CF4 interface
2. Containers - Provider - Configuration - Add New containers provider
3. 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
14. Cloudforms 4 :: Openshift 3
Configure Hawkular - Part 1
Create the service account
# oc project openshift-infra (should be there by default)
# oc create -f - <<API
apiVersion: v1
kind: ServiceAccount
metadata:
name: metrics-deployer
secrets:
- name: metrics-deployer
API
14
15. 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
16. 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.yaml
assetConfig:
.....
metricsPublicURL: https://metrics.app.os3.mlc.dom/hawkular/metrics
# systemctl restart atomic-openshift-master
16
Using a webbrowser, validate that Hawkular is started
20. Cloudforms 4 :: Openshift 3
Router for CF - map port 5000
At 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