OCM Hub Control Plane

TL;DR: “OCM Hub Control Plane” addon will help you to initiate and install the cluster manager (i.e. OCM’s control plane) components into the hosting cluster where your KubeVela control plane is running. Note that this addon will merely install the control plane components into the hub/central clusters, with that being said, the OCM agents will not be installed to the managed clusters so the existing clusters managed by vela will not be registered into OCM as the “ManagedCluster” resources.

KubeVela’s native multi-cluster functionalities is basically working based on the cluster-gateway which is responsible for routing and proxying kube api requests to the “controllee clusters”. The cluster-gateway is an aggregated apiserver that plugs a new “clustergateways/proxy” resource into the hosting cluster where your KubeVela controller is running, and it will help you deliver your requesting payload to the target cluster without reading the client credentials. So the KubeVela controller will be able to dynamically automate the multiple clusters configured/discovered.

OCM (Open Cluster Manager) is a modular, extensible, multi-cluster platform providing various multi-cluster functionalities as atomic “building blocks” to orchestrate their multi-cluster control plane. A minimal setup of OCM merely covers the installation of a registration-operator which is a typical Kubernetes operator that helps install/upgrade OCM components for us.

The overall status of the “OCM Cluster Manager” addon is visible by the following command in which you can clearly see if there’s anything going wrong with the addon installation:

  1. $ kubectl get clustermanager cluster-manager -o yaml
  2. apiVersion: operator.open-cluster-management.io/v1
  3. kind: ClusterManager
  4. metadata: ...
  5. spec: ...
  6. status:
  7. conditions:
  8. - lastTransitionTime: "2021-12-08T09:49:26Z"
  9. message: Registration is managing credentials
  10. reason: RegistrationFunctional
  11. status: "False"
  12. type: HubRegistrationDegraded
  13. - lastTransitionTime: "2021-12-08T09:49:40Z"
  14. message: Placement is scheduling placement decisions
  15. reason: PlacementFunctional
  16. status: "False"
  17. type: HubPlacementDegraded
  18. - lastTransitionTime: "2021-12-08T09:49:05Z"
  19. message: Components of cluster manager is applied
  20. reason: ClusterManagerApplied
  21. status: "True"
  22. type: Applied
  23. ...

Given that this addon doesn’t actually start the integration between OCM and cluster-gateway, we will need to either manually sync the cluster metadata from vela to OCM or go on enable the “ocm-gateway-manager-addon” addon to let the addon-manager do the automatic synchronization.

For clarification, after the successful installation of the addon, sadly the OCM control plane cannot automatically sync up with the previously joined cluster in KubeVela, so it’s recommended to repeat the cluster joining manually with:

  1. $ vela cluster join \
  2. <path to the kubeconfig of your joining managed cluster> \
  3. -t ocm \
  4. --name my-cluster

Then the joining cluster is supposed to be listed as a ManagedCluster in terms of your OCM control plane:

  1. $ kubectl get managedclusters
  2. NAME HUB ACCEPTED MANAGED CLUSTER URLS JOINED AVAILABLE AGE
  3. my-cluster true https://x.x.x.x:6443 True True 1h

After your OCM environment is all set, you can delegate the cluster registration to OCM by installation additional OCM modules including:

The further installation can be done by the following helm commands:

  1. $ helm repo add ocm https://open-cluster-management.oss-us-west-1.aliyuncs.com
  2. $ helm repo update
  3. $ # install the addons
  4. $ helm -n open-cluster-management-addon install cluster-proxy ocm/cluster-proxy --create-namespace
  5. $ helm -n open-cluster-management-addon install managed-serviceaccount ocm/managed-serviceaccount
  6. $ helm -n open-cluster-management-addon install cluster-gateway ocm/cluster-gateway-addon-manager
  7. # check addon installation
  8. $ kubectl get managedclusteraddon -n <cluster name>
  9. NAMESPACE NAME AVAILABLE DEGRADED PROGRESSING
  10. <cluster name> cluster-proxy True
  11. <cluster name> managed-serviceaccount True
  12. <cluster name> cluster-gateway True

An illustrative instruction for registering clusters via OCM is already prepared for you over here:

https://open-cluster-management.io/getting-started/quick-start/#deploy-a-klusterlet-agent-on-your-managed-cluster

Please reach out to the KubeVela official dev squad for the support.

Last updated on 2023年8月4日 by Daniel Higuero