Managed-Cluster#

Importing a K8s cluster as a RHACM Instance

This directory contains scripts to automate the importing of a K8s cluster (1.16.0 or above) to a RHACM Instance.

Set environment variables before importing:#

  1. Set the ACM_KUBECONFIG variable to hold the file path for kubernetes configuration of the RHACM cluster: export ACM_KUBECONFIG=...

  2. Set the CLUSTER_NAME variable to hold the name to be assigned to the managed-cluster (the name should be informative!): export CLUSTER_NAME=...

  3. Set the REMOTE_CONNECTION_TYPE variable to either kubeconfig or ssh to configure whether the deployment of the ACM managed-cluster addons should be done through kubectl directly or kubectl over ssh:

    • If you choose kubeconfig:

      1. Set the EDGE_KUBECONFIG variable to hold the file path for kubernetes configuration of the edge cluster: export EDGE_KUBECONFIG=...

    • If you choose ssh:

      1. Set the SHELL_ADDR variable to hold the user@address to connect to your edge cluster over ssh: export SHELL_ADDR=...

      2. Set the SSH_KEY variable to hold the file path for the key to use to connect to the machine addressed by SHELL_ADDR: export SSH_KEY=... — ## Importing The K8s Cluster After configuring the environment variables, execute the attach_managed_cluster.sh script:

      .resources/attach_managed_cluster.sh
      

      Assigning Labels on The Managed-Cluster

      Execute:

      kubectl label managedcluster $CLUSTER_NAME key=val
      

      (Replace key and val with the values you want. E.g., env=dev)


Removing an Imported Cluster#

Execute:

kubectl delete managedcluster $CLUSTER_NAME