本文主要是介绍OpenShift 4 - 多云管理(1) - 安装 RHACM、导入已有集群、配置观察功能(附视频),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
《OpenShift / RHEL / DevSecOps 汇总目录》
本文在 OpenShift 4.12 + RHACM 2.7 环境中进行验证。
文章目录
- 什么是 RHACM
- 安装 RHACM
- 导入已有 OpenShift 集群
- 添加“观察”功能
- 演示视频
- 参考
什么是 RHACM
RHACM(Advanced Cluster Management for Kubernetes)是 RedHat 面向 OpenShift 的多云管理产品,可以用来对分布在多云环境中 自建或托管 OpenShift 集群以及经认证的 Kubernetes 集群进行生命周期管理、发布和升级应用、统一安全策略管理、运行集中监控。
在 RHACM 的多云管理运行环境中包含以下两种角色:
1)Hub 是多云管理的控制平面,它可以运行在任一个 OpenShift 集群上。
2)Managed Cluster 是被管理的集群,它通过运行在本地的 Agent 接受 Hub 的管理指令。
安装 RHACM
- 在 OpenShift 控制台的 OperatorHub 中使用缺省选项安装 Advanced Cluster Management for Kubernetes。
- 在 Advanced Cluster Management for Kubernetes Operator 中使用缺省配置创建一个 MultiClusterHub 实例。
- 在创建完 MultiClusterHub 后可以在 open-cluster-management 项目中的拓扑中看到如下部署资源:
- 在 multicluster-engine 项目中的拓扑中看到如下部署资源:
- 同时还可查看在 open-cluster-management-hub 项目中部署的资源。说明,显示的数量取决于集群中 master 和 worker 节点数量。
$ oc get pods -n open-cluster-management-hub
NAME READY STATUS RESTARTS AGE
cluster-manager-placement-controller-5877987d64-qx796 1/1 Running 1 174m
cluster-manager-registration-controller-85765d8664-mvvw7 1/1 Running 1 174m
cluster-manager-registration-webhook-75b4ccb9d5-rnz64 2/2 Running 2 174m
cluster-manager-work-webhook-56d84b47cf-cj8dm 2/2 Running 2 174m
- 安装 MultiClusterHub 的过程会自动将当前 OpenShift 集群加入到 RHACM 的被管集群中。因此可以执行以下命令确认在当前 OpenShift 集群中自动创建了 open-cluster-management-agent 和 open-cluster-management-agent-addon 项目,并在项目中部署了 Agent 等资源。
$ oc get pods -n open-cluster-management-agent
NAME READY STATUS RESTARTS AGE
klusterlet-65b545d7c6-72nwj 1/1 Running 1 174m
klusterlet-registration-agent-6df94f664f-49wgr 1/1 Running 1 174m
klusterlet-work-agent-7cb5797f9b-nn5pf 1/1 Running 1 174m$ oc get pods -n open-cluster-management-agent-addon
NAME READY STATUS RESTARTS AGE
application-manager-6667f6cd95-72bst 1/1 Running 3 (12m ago) 172m
cert-policy-controller-5df57878d5-sf8bh 1/1 Running 1 173m
cluster-proxy-proxy-agent-8877dd776-5hjjf 2/2 Running 2 174m
cluster-proxy-service-proxy-6f47d6b4b7-vwggf 1/1 Running 1 174m
config-policy-controller-56b78cb7d9-hr5zk 2/2 Running 2 173m
governance-policy-framework-79fb79986b-5nc2r 2/2 Running 2 173m
iam-policy-controller-8986b879f-zz284 1/1 Running 1 173m
klusterlet-addon-workmgr-788647c859-nm9bl 1/1 Running 1 174m
- 此时安装好的 MultiClusterHub 的实例显示 Running 状态。
- 在 OpenShift 控制台中可以看到已经多了 “local-cluster” 下拉框,点击下拉框中的 “All Clusters” 即可进入 ACM 控制台。
- 可以在 Overview 中查看当前 ACM 管理的集群资源。
- 在 Clusters 中目前只有一个 local-cluster 集群,即 ACM Hub 部署运行的 OpenShift 集群。
- 可以查看被管集群的节点。
导入已有 OpenShift 集群
- 在 Clusters 中点击 “Import cluster” 按钮。在 Import a exiting cluster 页面中的 Import Mode 选择 Enter your server URL and API token for exiting cluster 一项,然后提供这个集群的 API Server URL 和 API Token。
- 在导入后会自动向被管集群安装 Add-on 运行环境。
可以在被管集群中查看部署在 open-cluster-management-agent 和 open-cluster-management-agent-addon 项目中的资源。
$ oc get pods -n open-cluster-management-agent
NAME READY STATUS RESTARTS AGE
klusterlet-565bfd9ccc-26hxr 1/1 Running 0 4m58s
klusterlet-registration-agent-57c4f77f59-hwh4x 1/1 Running 0 4m45s
klusterlet-work-agent-65df5765f7-qj45b 1/1 Running 0 4m27s$ oc get pods -n open-cluster-management-agent-addon
NAME READY STATUS RESTARTS AGE
application-manager-66c75d955-mzvl8 1/1 Running 0 4m35s
cert-policy-controller-5bb8bb55b-8t584 1/1 Running 0 4m30s
cluster-proxy-proxy-agent-767cd9f84d-9ghps 2/2 Running 0 4m32s
cluster-proxy-service-proxy-8b99ffc7d-8tzr8 1/1 Running 0 4m34s
config-policy-controller-85b88cc796-sxjxf 2/2 Running 0 3m25s
governance-policy-framework-656c5fdb9-nfcmw 2/2 Running 0 3m25s
iam-policy-controller-5bf5bf76c8-w65vp 1/1 Running 0 4m33s
klusterlet-addon-search-64f64cb7d7-hxqlx 1/1 Running 0 4m31s
klusterlet-addon-workmgr-6b9bcc9954-9lp8w 1/1 Running 0 3m57s
- 可以在 Clusters 的 Cluster list 中看到被成功导入的集群。
添加“观察”功能
RHACM 可以集中监控被管节点的运行情况,这是通过运行在 RHACM Hub 上的 Observatorium 实现的。RHACM Hub 通过 Observatorium 从被管集群获取到观察数据后再通过 Thanos 保存到 S3 对象存储中,并通过 Grafana 进行数据展示。
以下示例将使用 minio 来存储观察数据:
- 执行命令安装 minio 环境。
$ oc new-project open-cluster-management-observability
$ git clone https://github.com/liuxiaoyu-git/multicluster-observability-operator.git
$ oc apply -k multicluster-observability-operator/examples/minio/ -n open-cluster-management-observability
- 执行命令可以查看为 thanos 提供的 S3 存储访问方式。
$ oc extract secret/thanos-object-storage --to=- -n open-cluster-management-observability
# thanos.yaml
type: s3
config:bucket: "thanos"endpoint: "minio:9000"insecure: trueaccess_key: "minio"secret_key: "minio123"
- 执行命令在 RHACM Hub 中安装“观察”功能。
$ oc apply -f https://raw.githubusercontent.com/liuxiaoyu-git/rhacm-workshop/master/03.Observability/exercise/multiclusterobservability.yaml -n open-cluster-management-observability
- 安装后可以查看在 open-cluster-management-observability 中运行的的 Pod 和部署的资源。
$ oc get pods -n open-cluster-management-observability
NAME READY STATUS RESTARTS AGE
minio-8b9dfc5bc-gt6tz 1/1 Running 0 9m52s
observability-alertmanager-0 3/3 Running 0 9m16s
observability-alertmanager-1 3/3 Running 0 8m49s
observability-alertmanager-2 3/3 Running 0 8m18s
observability-grafana-7855cfb5d9-jbgpn 2/2 Running 0 9m16s
observability-grafana-7855cfb5d9-k9z7l 2/2 Running 0 9m16s
observability-observatorium-api-655748549-rclq4 1/1 Running 0 8m54s
observability-observatorium-api-655748549-t6h8f 1/1 Running 0 8m54s
observability-observatorium-operator-78b49598dc-2vs7m 1/1 Running 0 9m16s
observability-rbac-query-proxy-598bcd6db8-vn9lm 2/2 Running 0 9m15s
observability-rbac-query-proxy-598bcd6db8-xm2d4 2/2 Running 0 9m15s
observability-thanos-compact-0 1/1 Running 0 8m54s
observability-thanos-query-768679f974-6xzdm 1/1 Running 0 8m54s
observability-thanos-query-768679f974-lfjxg 1/1 Running 0 8m54s
observability-thanos-query-frontend-749864469d-sjrd7 1/1 Running 0 8m54s
observability-thanos-query-frontend-749864469d-xpwq5 1/1 Running 0 8m54s
observability-thanos-query-frontend-memcached-0 2/2 Running 0 8m54s
observability-thanos-query-frontend-memcached-1 2/2 Running 0 8m37s
observability-thanos-query-frontend-memcached-2 2/2 Running 0 8m21s
observability-thanos-receive-controller-5b5d8bd59d-n5k7r 1/1 Running 0 8m54s
observability-thanos-receive-default-0 1/1 Running 0 8m54s
observability-thanos-receive-default-1 1/1 Running 0 8m29s
observability-thanos-receive-default-2 1/1 Running 0 8m7s
observability-thanos-rule-0 2/2 Running 0 8m54s
observability-thanos-rule-1 2/2 Running 0 8m28s
observability-thanos-rule-2 2/2 Running 0 8m2s
observability-thanos-store-memcached-0 2/2 Running 0 8m54s
observability-thanos-store-memcached-1 2/2 Running 0 8m36s
observability-thanos-store-memcached-2 2/2 Running 0 8m21s
observability-thanos-store-shard-0-0 1/1 Running 0 8m54s
observability-thanos-store-shard-1-0 1/1 Running 0 8m54s
observability-thanos-store-shard-2-0 1/1 Running 2 (8m36s ago) 8m54s
- 成功部署“观察”后可以在 ACM 控制台的 Clusters 页面中右上方看到 Grafana 链接。
- 进入 Grafana 后可以看到被管集群的运行状态。
- 进入上图的一个集群,可以查看该集群的运行情况。
演示视频
视频
参考
https://github.com/michaelkotelnikov/rhacm-workshop
这篇关于OpenShift 4 - 多云管理(1) - 安装 RHACM、导入已有集群、配置观察功能(附视频)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!