Skip to content

open-cluster-management-io/multicloud-operators-subscription

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multicloud-operators-subscription

License

Overview

Subscriptions (subscription.apps.open-cluster-management.io) allow clusters to subscribe to a source repository channel that can be the following types: Git repository, Helm release registry, or Object storage repository.

Subscriptions can point to a channel for identifying new or updated resource templates. The subscription operator can then download directly from the storage location and deploy to targeted managed clusters without checking the hub cluster first. With a subscription, the subscription operator can monitor the channel for new or updated resources instead of the hub cluster.

Architecture

architecture

Stand-alone deployment

Deploy the subscription operator.

$ git clone https://github.com/open-cluster-management-io/multicloud-operators-subscription.git
$ cd multicloud-operators-subscription
$ make deploy-standalone
$ kubectl -n open-cluster-management get deploy  multicluster-operators-subscription
NAME                                READY   UP-TO-DATE   AVAILABLE   AGE
multicluster-operators-subscription   1/1     1            1           21m

Create a Helm channel and subscribe to it.

kubectl apply -f ./examples/helmrepo-channel

Find the nginx pods that are deployed to the current namespace. You should have 3 backend pods with the controller.

$ kubectl get pods -l app.kubernetes.io/name=ingress-nginx
NAME                                                   READY   STATUS    RESTARTS   AGE
ingress-nginx-simple-controller-84bbdd59f7-ccnwt       1/1     Running   0          4m36s
ingress-nginx-simple-defaultbackend-78669bfbbb-b6rwh   1/1     Running   0          4m36s
ingress-nginx-simple-defaultbackend-78669bfbbb-hb9g6   1/1     Running   0          4m36s
ingress-nginx-simple-defaultbackend-78669bfbbb-nmkng   1/1     Running   0          4m36s

Multi-cluster deployment

Prerequisite

Install the clusteradm CLI tool. For more information see here.

Using clusteradm, deploy a cluster manager on your hub cluster and deploy a klusterlet agent on your managed cluster. For more information see here.

Operator Deployment

Deploy the subscription operator on the hub cluster.

$ kubectl config use-context <hub cluster context> # kubectl config use-context kind-hub
$ clusteradm install hub-addon --names application-manager
$ kubectl -n open-cluster-management get deploy  multicluster-operators-subscription
NAME                                READY   UP-TO-DATE   AVAILABLE   AGE
multicluster-operators-subscription   1/1     1            1           25s
$ kubectl -n open-cluster-management wait deploy multicluster-operators-subscription --for condition=available

Add-on Deployment

Enable the subscription add-on for managed cluster. For the value of <managed cluster name>, choose the managed cluster you want to install the add-on to by running the command kubectl get managedclusters on the hub cluster.

$ kubectl config use-context <hub cluster context> # kubectl config use-context kind-hub
$ kubectl get managedclusters
NAME                        HUB ACCEPTED   MANAGED CLUSTER URLS      JOINED   AVAILABLE   AGE
<managed cluster name>      true           https://127.0.0.1:38745   True     True        21s
$ clusteradm addon enable --names application-manager --clusters <managed cluster name> # clusteradm addon enable --names application-manager --clusters cluster1
$ kubectl -n <managed cluster name> get managedclusteraddon # kubectl -n cluster1 get managedclusteraddon
NAME                  AVAILABLE   DEGRADED   PROGRESSING
application-manager   True

Check the the subscription add-on deployment on the managed cluster.

$ kubectl config use-context <managed cluster context> # kubectl config use-context kind-cluster1
$ kubectl -n open-cluster-management-agent-addon get deploy application-manager
NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
application-manager   1/1     1            1           103s

What is next

After a successful deployment, test the subscription operator with a helm subscription. Run the following command:

git clone https://github.com/open-cluster-management-io/multicloud-operators-subscription.git
cd multicloud-operators-subscription
kubectl config use-context <hub cluster context> # kubectl config use-context kind-hub
kubectl apply -f examples/helmrepo-hub-channel

After a while, you should see the subscription propagated to the managed cluster and the Helm app installed. By default, when a subscription deploys subscribed applications to target clusters, the applications are deployed to that subscription namespace. To confirm, run the following command:

$ kubectl config use-context <managed cluster context> # kubectl config use-context kind-cluster1
$ kubectl get subscriptions.apps
NAME        STATUS       AGE    LOCAL PLACEMENT   TIME WINDOW
nginx-sub   Subscribed   2m50s   true
$ kubectl get pod
NAME                                                   READY   STATUS    RESTARTS   AGE
ingress-nginx-simple-controller-84bbdd59f7-l7t9f       1/1     Running   0          3m34s
ingress-nginx-simple-defaultbackend-78669bfbbb-d498w   1/1     Running   0          3m34s
ingress-nginx-simple-defaultbackend-78669bfbbb-n47r2   1/1     Running   0          3m34s
ingress-nginx-simple-defaultbackend-78669bfbbb-r2xjn   1/1     Running   0          3m34s

GitOps subscription

You can subscribe to public or enterprise Git repositories that contain Kubernetes resource YAML files or Helm charts, or both. See Git repository channel subscription for more details.

Object storage subscription

You can subscribe to cloud object storage that contain Kubernetes resource YAML files. See Object storage channel subscription for more details.

Community, discussion, contribution, and support

Check the CONTRIBUTING Doc for how to contribute to the repo.

Communication channels

Slack channel: #open-cluster-mgmt

License

This code is released under the Apache 2.0 license. See the file LICENSE for more information.