Importing an Azure Kubernetes Service cluster
Follow the procedure to import an Azure Kubernetes Service cluster. See Azure Kubernetes Service for more information about the public Kubernetes service.
- Prerequisites
- Prepare for import
- Create your IBM Multicloud Manager
config.yamlfile - Importing a cluster
Required user type or access level: Cluster administrator
Prerequisites
-
You must have an IBM Multicloud Manager hub cluster, which is an IBM Cloud Private cluster with
multi-cluster hubenabled andsingle_cluster_modeset tofalse. -
You need to install the Azure CLI and authenticate. See Install the Azure CLI
for instructions to install the CLI.
-
You must enable monitoring and RBAC on your Azure Kubernetes Service cluster.
Prepare for import
You need to create an <import_config_directory> directory to store your import configuration files.
To learn more about the import command and see [options] that are available, see IBM Cloud Private CLI multicluster commands (mc).
Generating your kubeconfig file for the targeted managed cluster
-
From a terminal, go to your
<import_config_directory>directory. -
Log in to Azure Cloud Platform with the following command, which opens a browser for authentication:
az login -
Set the
KUBECONFIGenvironment variable with the following command:export KUBECONFIG=kubeconfig -
Obtain your cluster access information by running the following command:
az aks get-credentials \ --resource-group <resource_group> \ --name <cluster_name> \ --file ./kubeconfig -
Verify the content of the
kubeconfigfile. Be sure that you have one value forclusters, one value forcontexts, and one value forusers. See the following example output:apiVersion: v1 clusters: - cluster: certificate-authority-data: <ca-data> server: <targeted-managed cluster-kubernete-api-server> name: <cluster_name> contexts: - context: cluster: <cluster_name> user: <username> name: <cluster_name>-context current-context: <cluster_name>-context kind: Config preferences: {} users: - name: <username> user: client-certificate-data: <client-certificate-data> client-key-data: <client-key-data> token: <token> -
Verify that you can connect to your targeted managed cluster with
kubectlby using thekubeconfig. Run anykubectlcommand. If you receive anunable to connecterror, delete the file and retry. -
Unset the
KUBECONFIGenvironment variable to avoid modifying thekubeconfigfile as you proceed. Run the following command:unset KUBECONFIG
Create your IBM Multicloud Manager cluster-import.yaml configuration file
-
From a terminal, go to your
<import_config_directory>directory. -
Log in to your hub-cluster with
cloudctl loginthe following command:cloudctl login -a https://<Hub Cluster Master Host>:<Cluster Master API Port> --skip-ssl-validation -
Run the following command to create the configuration template,
cluster-import.yaml, where<cluster_name>is the name of the cluster resource on the hub, and<cluster_namespace>is the namespace of the cluster resources on the hub:cloudctl mc cluster template <cluster_name> -n <cluster_namespace> > cluster-import.yaml -
Open the
cluster-import.yamlfile and configure the following parameters:default_admin_user: The cluster administrator username for the target managed clustercontainer_runtime:The container runtime used in the cluster, currently supported options aredockerandcontainerd
See the Multicluster-endpoint settings section of Customizing the cluster with the config.yaml file for more parameters.
You are now ready to import a cluster.
Importing the cluster
-
From a terminal, go to your
<import_config_directory>directory. -
Log in to your hub-cluster with
cloudctl login. Run the following command:cloudctl login -a https://<Cluster Master Host>:<Cluster Master API Port> --skip-ssl-validation -
Run the following command to import to the targeted managed cluster:
cloudctl mc cluster import -f <cluster-import.yaml> -K kubeconfig | tee cluster-import.log -
Verify that the cluster is successfully imported.
- Log in to your IBM Multicloud Manager hub cluster.
- From the navigation bar, click Clusters.
- Find your new imported managed cluster in the list.
- Ensure the the status is Ready. Depending on environment, it may take a few minutes to see the status.