openshift 容器云从入门到崩溃之十《容器监控-数据展示》

时间:2023-03-09 19:20:59
openshift 容器云从入门到崩溃之十《容器监控-数据展示》

POD资源历史曲线(CPU、内存、网络)

监控方案heapster+hawkular-metrics+hawkular-cassandra

heapster负责收集数据

hawkular-cassandra 存储数据

hawkular-metrics 展示数据

部署方案

修改/etc/ansible/hosts添加一下内容

这里要注意看要不要持久化

[OSEv3:vars]
openshift_metrics_install_metrics=true
openshift_metrics_cassandra_storage_class_name=gluster-storag
openshift_metrics_cassandra_storage_type=dynamic
openshift_metrics_cassandra_pvc_size=20Gi
openshift_metrics_cassandra_limits_memory=2Gi
openshift_metrics_cassandra_requests_memory=1Gi
openshift_metrics_cassandra_limits_cpu=500m
openshift_metrics_cassandra_requests_cpu=200m
openshift_metrics_hawkular_limits_cpu=500m
openshift_metrics_hawkular_requests_cpu=200m
openshift_metrics_hawkular_requests_memory=1Gi
openshift_metrics_hawkular_limits_memory=2Gi
openshift_metrics_heapster_limits_memory=256Mi
openshift_metrics_heapster_limits_cpu=200m
openshift_metrics_heapster_requests_memory=128Mi
openshift_metrics_heapster_requests_cpu=50m
openshift_metrics_duration=
openshift_metrics_resolution=30s

运行部署

# ansible-playbook openshift-ansible/playbooks/openshift-metrics/config.yml

查看有没有部署成功

# oc project openshift-metrics
# oc get pod

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

运行完之后登陆web console 找个pod点开Metrics

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

集群资源展示

监控方案 prometheus + grafana

prometheus收集集群数据

grafana 负责集群展示

部署prometheus+grafana

修改/etc/ansible/hosts添加一下内容

[OSEv3:vars]
openshift_cluster_monitoring_operator_install=true
openshift_cluster_monitoring_operator_prometheus_storage_enabled=true
openshift_cluster_monitoring_operator_prometheus_storage_capacity=
openshift_cluster_monitoring_operator_prometheus_storage_class_name=gluster-storag

运行部署

# ansible-playbook openshift-ansible/playbooks/openshift-prometheus/config.yml
# ansible-playbook openshift-ansible/playbooks/openshift-glusterfs/config.yml

查看有没有部署成功

# oc project openshift-metrics
# oc get pod

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

打开控制台开始配置

http://prometheus-openshift-metrics.oc.downtown8.com/

http://grafana-openshift-metrics.oc.downtown8.com/

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

prometheus基本不用配置安装程序已经跟k8s对接好了

主要是配置一下grafana的k8s插件

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

初步的效果

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

集群内存

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

集群CPU

openshift 容器云从入门到崩溃之十《容器监控-数据展示》

集群网络

openshift 容器云从入门到崩溃之十《容器监控-数据展示》