Importing a cluster with the CLI

After you install IBM Multicloud Manager, you are ready to import a cluster to manage.

Prerequisites

Supported architecture

Prepare to import

To learn more about the import command and see [options] that are available, see IBM Cloud Private CLI multicluster commands (mc).

Note: By default, the multicluster-endpoint deployment pulls all of the required images from Docker Hub. You only need to install images from DockerHub if you are working in an air gapped environment.

  1. Log in to your hub-cluster with cloudctl login. Run the following command:

    cloudctl login -a https://<Hub Cluster Master Host>:<Cluster Master API Port> --skip-ssl-validation
    
  2. Run the following command to create the configuration template, cluster-import-config.yaml, where <name> is the name of the cluster resource on the hub, and <namespace> is the namespace of the cluster resources on the hub:

    cloudctl mc cluster template {name} [-n|--namespace {namespace}] > cluster-import-config.yaml
    

    See Table 1. YAML file parameters and description for details about each parameter in cluster-import-config.yaml.

  3. Create a cluster resource. When you create the cluster resource, you automatically create a namespace, a service account, a secret, and a cluster registry in the hub cluster.

    cloudctl mc cluster create -f cluster-import-config.yaml
    

    See kubernetes/cluster-registry Opens in a new tab in the hub cluster.

  4. Generate the cluster-import.yaml

    cloudctl mc cluster import {name} [-n|--namespace {namespace}] > cluster-import.yaml
    

YAML Parameters and descriptions

Table 1: The following table lists the parameters and descriptions that are available in the YAML file:

Parameter Description Default value
clusterLabels Provide cluster labels; you can add labels to your file none
cloud The cloud provider label for your cluster auto-detect
vendor The Kubernetes vendor label for your cluster auto-detect
environment The environment label for your cluster Dev
region The region where your cluster is set up US
version Version of multicluster-endpoint 3.2.1
ApplicationManager Enables multicluster manager application deployment, deploys subscription controller and deployable controller true
tillerIntegration Enables IBM tiller to deploy Helm release true
prometheusIntegration Enables integration to IBM or OpenShift monitoring for metric collection true
topologyCollector Enables cluster topology data collection for the Topology page true
searchCollector Enables search collection and indexing true
policyController Enable the Governance and risk dashboard policy feature true
metering Enable the Governance and risk dashboard policy feature false
serviceRegistry Service registry that is used to discover services that are deployed by Application Deployable among managed clusters. false
dnsSuffix The suffix of the registry DNS name, which is added to the end of the target clusters dns domain name. mcm.svc
plugins Comma-separated list of enabled plugins. Supported plugins: kube-service, kube-ingress, and istio. kube-service
private_registry_enabled Enable if using a private Docker registry false
docker_username User name for the private Docker registry None
docker_password Password for the private Docker registry none
imageRegistry The image registry from which to pull the multicluster-endpoint ibmcom
imageNamePostfix Postfix for the image name none
migrateFrom320 Migration from 3.2.0 multicluster-endpoint false

Note: Do not remove parameters, as the management console might not properly render.

Importing the cluster

  1. Configure your kubectl for your targeted managed cluster.

    See Supported cloud providers to learn how to configure your kubectl.

  2. Run the following command to import the targeted managed cluster:

    kubectl apply -f cluster-import.yaml
    

    If you receive the following error, run the command again:

    error: unable to recognize "STDIN": no matches for kind "Endpoint" in version "multicloud.ibm.com/v1beta1"
    
  3. Verify that the cluster is successfully imported.

Deleting an imported cluster

You can delete your IBM Multicloud Manager managed cluster resources from the hub cluster so that it is not a managed cluster.

  1. Log in to your hub cluster with cloudctl login.

    cloudctl login -a https://<Cluster Master Host>:<Cluster Master API Port> --skip-ssl-validation
    
  2. Run the following command to remove the managed cluster:

    kubectl delete cluster {name} --namespace {namespace}
    

    Removing a cluster can take a few minutes.

  3. Verify that your cluster was removed from the list by running the following command:

    kubectl get clusters --all-namespaces