Prerequisites

Procedure

  1. Deploy KubeFed.
    1. Log on to the Container Service console.
    2. In the left-side navigation pane under Container Service - Kubernetes, choose Marketplace > App Catalog. On the App Catalog page, click ack-kubefed-init.
    3. On the App Catalog - ack-kubefed-init page, click the Parameters tab to customize parameters of KubeFed, as shown in the following figure.
      Note The configuration items under the resources parameter specify limits on the CPU and memory resources for the federation-controller-manager service. Configure these items based on the size of the clusters to join the federation. Retain the default values for other parameters.
    4. In the right-side Deploy section, the namespace and release name are automatically set to federation-system and kubefed-operator. Select cluster1 as the host cluster of the federation and click Create.
      Wait for a few seconds. The Helm Releases - kubefed-operator page appears. On this page, you can find that the federation service has been created in cluster1.
  2. Add clusters to the federation.
    1. Run the kubectl config get-contexts command in cluster1. The following information appears, indicating that the cluster federation has been configured:
      CURRENT   NAME       CLUSTER    AUTHINFO            NAMESPACE
      *         cluster1   cluster1   kubernetes-admin1
                cluster2   cluster2   kubernetes-admin2
    2. Run the following commands to add clusters to the federation:
      kubefedctl join cluster1 --cluster-context cluster1 \
          --host-cluster-context cluster1 --add-to-registry --v=2
      kubefedctl join cluster2 --cluster-context cluster2 \
          --host-cluster-context cluster1 --add-to-registry --v=2
      Note To add a third or more clusters, repeat the second command and replace the cluster names with new ones.
      kubefedctl join cluster1 --cluster-context cluster1 \
          --host-cluster-context cluster1 --add-to-registry --v=2
      kubefedctl join cluster2 --cluster-context cluster2 \
          --host-cluster-context cluster1 --add-to-registry --v=2
      kubefedctl join cluster3 --cluster-context cluster3 \
          --host-cluster-context cluster1 --add-to-registry --v=2
    3. Run the kubectl get federatedcluster -n federation-system command. If the following information appears, the clusters have been added to the federation:
      NAME       READY   AGE
      cluster1   True    23s
      cluster2   True    10s