Adding a control plane node (IBM Cloud Pak for AIOps on Linux)

Learn how to add a control plane node to a Linux cluster that has a deployment of IBM Cloud Pak for AIOps running on it.

Procedure

  1. Set environment variables.

    1. Set default values for environment variables that might not exist in aiops_var.sh on upgraded deployments of IBM Cloud Pak for AIOps.

      Edit the shell script aiops_var.sh that you created when you installed IBM Cloud Pak for AIOps on your Linux cluster. Verify that you have the following environment variables set: CLUSTER_CIDR, SERVICE_CIDR, HTTP_PROXY, HTTPS_PROXY, NO_PROXY.

      If any are not defined, then set them to an empty string, as in the following example:
      export CLUSTER_CIDR=""
      export SERVICE_CIDR=""
      export CLUSTER_DNS=""
      export HTTP_PROXY=""
      export HTTPS_PROXY=""
      export NO_PROXY=""

      For more information about aiops_var.sh, see Create environment variables in Online installation of IBM Cloud Pak for AIOps on Linux or Offline installation of IBM Cloud Pak for AIOps on Linux.

    2. Run the following command to source the shell script aiops_var.sh that you created when you installed IBM Cloud Pak for AIOps on your Linux cluster.
      . ./aiops_var.sh
      
    3. Set an environment variable for the new control plane node that you want to add.
      export NEW_CP_NODE="<new_cp_node>"
      

      Where <new_cp_node> is the FQDN or IP address of the control plane node to be added, for example test-server4.acme.com.

    4. If the main control plane node is down or offline, then run the following command:
      export CONTROL_PLANE_NODE="<other_cp_node>"
      

      Where <other_cp_node> is the FQDN or IP address of a working control plane node that is an entry in the ADDITIONAL_CONTROL_PLANE_NODES array in aiops_var.sh.

  2. Configure a new control plane node.

    Run the commands in one of the following codeblocks, depending on whether your deployment is online or offline.

    Online deployments

    K3S_TOKEN=$(ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} aiopsctl cluster node info --token-only)
    K3S_HOST=$(ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} aiopsctl cluster node info --server-url-only)
    
    ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} ssh ${TARGET_USER}@${NEW_CP_NODE} curl -LO "${AIOPSCTL_INSTALL_URL}"
    ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} ssh ${TARGET_USER}@${NEW_CP_NODE} tar xvf "${AIOPSCTL_TAR}"
    ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} ssh ${TARGET_USER}@${NEW_CP_NODE} mv aiopsctl /usr/local/bin/aiopsctl
    
    CLUSTER_CIDR_FLAG=$(if [ -n "${CLUSTER_CIDR}" ]; then echo "--cluster-cidr=${CLUSTER_CIDR} "; fi)
    SERVICE_CIDR_FLAG=$(if [ -n "${SERVICE_CIDR}" ]; then echo "--service-cidr=${SERVICE_CIDR} "; fi)
    CLUSTER_DNS_FLAG=$(if [ -n "${CLUSTER_DNS}" ]; then echo "--cluster-dns=${CLUSTER_DNS} "; fi) 
    
    HTTP_PROXY_FLAG=$(if [ -n "${HTTP_PROXY}" ]; then echo "--http-proxy=${HTTP_PROXY} "; fi)
    HTTPS_PROXY_FLAG=$(if [ -n "${HTTPS_PROXY}" ]; then echo "--https-proxy=${HTTPS_PROXY} "; fi)
    NO_PROXY_FLAG=$(if [ -n "${NO_PROXY}" ]; then echo "--no-proxy=${NO_PROXY} "; fi)
    
    ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} ssh ${TARGET_USER}@${NEW_CP_NODE} aiopsctl cluster node up --accept-license=${ACCEPT_LICENSE} --role=control-plane --server-url="${K3S_HOST}" --token="${K3S_TOKEN}" --registry-token="${IBM_ENTITLEMENT_KEY}" --app-storage="${APP_STORAGE_PATH}" --platform-storage="${PLATFORM_STORAGE_PATH}" --load-balancer-host="${LOAD_BALANCER_HOST}" ${CLUSTER_CIDR_FLAG}${SERVICE_CIDR_FLAG}${CLUSTER_DNS_FLAG}${HTTP_PROXY_FLAG}${HTTPS_PROXY_FLAG}${NO_PROXY_FLAG}

    Offline deployments

    Run the following commands from your bastion host:

    K3S_TOKEN=$(ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} aiopsctl cluster node info --token-only)
    K3S_HOST=$(ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} aiopsctl cluster node info --server-url-only)
    
    ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} scp /usr/local/bin/aiopsctl ${TARGET_USER}@${NEW_CP_NODE}:/usr/local/bin/aiopsctl
    
    CLUSTER_CIDR_FLAG=$(if [ -n "${CLUSTER_CIDR}" ]; then echo "--cluster-cidr=${CLUSTER_CIDR} "; fi)
    SERVICE_CIDR_FLAG=$(if [ -n "${SERVICE_CIDR}" ]; then echo "--service-cidr=${SERVICE_CIDR} "; fi)
    CLUSTER_DNS_FLAG=$(if [ -n "${CLUSTER_DNS}" ]; then echo "--cluster-dns=${CLUSTER_DNS} "; fi) 
    
    HTTP_PROXY_FLAG=$(if [ -n "${HTTP_PROXY}" ]; then echo "--http-proxy=${HTTP_PROXY} "; fi)
    HTTPS_PROXY_FLAG=$(if [ -n "${HTTPS_PROXY}" ]; then echo "--https-proxy=${HTTPS_PROXY} "; fi)
    NO_PROXY_FLAG=$(if [ -n "${NO_PROXY}" ]; then echo "--no-proxy=${NO_PROXY} "; fi)
    
    ssh ${TARGET_USER}@${CONTROL_PLANE_NODE} ssh ${TARGET_USER}@${NEW_CP_NODE} aiopsctl cluster node up --accept-license=${ACCEPT_LICENSE} --role=control-plane --server-url="${K3S_HOST}" --token="${K3S_TOKEN}" registry="${TARGET_REGISTRY}" --registry-user="${TARGET_REGISTRY_USER}" --registry-token="${TARGET_REGISTRY_PASSWORD}" --offline --insecure-skip-tls-verify="${SKIP_TLS}" --app-storage="${APP_STORAGE_PATH}" --platform-storage="${PLATFORM_STORAGE_PATH}" --load-balancer-host="${LOAD_BALANCER_HOST}" ${CLUSTER_CIDR_FLAG}${SERVICE_CIDR_FLAG}${CLUSTER_DNS_FLAG}${HTTP_PROXY_FLAG}${HTTPS_PROXY_FLAG}${NO_PROXY_FLAG}
  3. Update the environment variables script aiops_var.sh. This is to maintain the accuracy of the environment variables file.

    When your new control plane node is successfully added and configured, update the aiops_var.sh file.

    • If you added the new control plane node as an additional control plane node, then add an entry for it to the ADDITIONAL_CONTROL_PLANES array.
    • If you added the new control plane node as the main control plane node, then set the value of CONTROL_PLANE_NODE to be your new control plane node.
  4. Update your load balancer's configuration for the control plane node that you just added.