RHCA之路—EX280(10)
1. 题目
On master.lab.example.com install the OpenShift Mertics component with the following requirements:
Use the storage /exports/metrics for cassandra storage. You can use the files on http://materials.example.com/exam280/storage for the pv sample.
Use the inventory, ansible.cfg in /root/install-metrics/
Use the playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml for the installation
Use the following environmet variables:
openshift_metrics_image_version=3.9
openshift_metrics_heapster_requests_memory=300M
openshift_metrics_hawkular_requests_memory=750M
openshift_metrics_cassandra_requests_memory=750M
openshift_metrics_cassandra_storage_type=pv
openshift_metrics_cassandra_pvc_size=5Gi
openshift_metrics_cassandra_pvc_prefix=metrics
openshift_metrics_install_metrics=True
2. 解题
2.1 PV
2.1.1 下载pv
[root@master ex280]# cd /root/install-metrics/
[root@master install-metrics]# wget http://materials.example.com/exam280/storage/pv.yaml
--2023-09-04 17:03:08-- http://materials.example.com/exam280/storage/pv.yaml
Resolving materials.example.com (materials.example.com)... 172.25.254.254
Connecting to materials.example.com (materials.example.com)|172.25.254.254|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 230
Saving to: ‘pv.yaml’
100%[===========================================================================================================>] 230 --.-K/s in 0s
2023-09-04 17:03:08 (44.2 MB/s) - ‘pv.yaml’ saved [230/230]
2.1.2 pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: metricspv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
nfs:
path: /exports/metrics
server: services.lab.example.com
persistentVolumeReclaimPolicy: Recycle
2.1.3 部署pv
[root@master install-metrics]# oc create -f pv.yaml
persistentvolume "metricspv" created
2.2 ansible配置
2.2.1 搜索镜像
[root@services ~]# docker-registry-cli registry.lab.example.com search metrics ssl
available options:-
-----------
1) Name: openshift3/ose-metrics-hawkular-metrics
Tags: latest v3.9
-----------
2) Name: openshift3/ose-metrics-heapster
Tags: latest v3.9
-----------
3) Name: openshift3/ose-metrics-cassandra
Tags: latest v3.9
3 images found !
2.2.2 编辑inventory
在[OSEv3:vars]下追加以下内容
openshift_metrics_image_prefix=registry.lab.example.com/openshift3/ose-
openshift_metrics_image_version=v3.9
openshift_metrics_heapster_requests_memory=300M
openshift_metrics_hawkular_requests_memory=750M
openshift_metrics_cassandra_requests_memory=750M
openshift_metrics_cassandra_storage_type=pv
openshift_metrics_cassandra_pvc_size=5Gi
openshift_metrics_cassandra_pvc_prefix=metrics
openshift_metrics_install_metrics=True
2.2.3 使用ansible部署项目
[root@master install-metrics]# ansible-playbook /usr/share/ansible/openshift-ansible/playbooks/openshift-metrics/config.yml
3. 确认
[root@master install-metrics]# oc get route -n openshift-infra
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
hawkular-metrics hawkular-metrics.apps.lab.example.com hawkular-metrics <all> reencrypt None
workstation服务器上访问
http://hawkular-metrics.apps.lab.example.com/
workstation服务器上访问
https://master.lab.example.com/
选择任意项目
打开application—>pods
进入任意pod,点击Metrics选项卡
可以看到数据即说明该题基本正确
以上便是RHCA 280全部考试内容