Collect cluster logs

Collect cluster logs

While operating your management, regional, or managed cluster, you may require collecting and inspecting the cluster logs to analyze cluster events or troubleshoot issues. For the logs structure, see Deployment Guide: Collect the bootstrap logs.

To collect cluster logs:

  1. Choose from the following options:

    • If you did not delete the kaas-bootstrap folder from the bootstrap node, log in to the bootstrap node.

    • If you deleted the kaas-bootstrap folder:

      1. Log in to a local machine running Ubuntu 18.04 where kubectl is installed.

      2. Download and run the Container Cloud bootstrap script:

        chmod 0755
  2. Obtain kubeconfig of the required cluster. The management or regional cluster kubeconfig files are created during the last stage of the management or regional cluster bootstrap. To obtain a managed cluster kubeconfig, see Connect to a Mirantis Container Cloud cluster.

  3. Obtain the private SSH key of the required cluster. For a management or regional cluster, ssh_key is created during bootstrap of the corresponding cluster in the same directory as the bootstrap script. For a managed cluster, this is an SSH key added in the Container Cloud web UI before the managed cluster creation.

  4. Depending on the cluster type that you require logs from, run the corresponding command:

    • For a management cluster:

      kaas collect logs --management-kubeconfig <pathToMgmtClusterKubeconfig> \
      --key-file <pathToMgmtClusterPrivateSshKey> \
      --cluster-name <clusterName> --cluster-namespace <clusterProject>
    • For a regional cluster:

      kaas collect logs --management-kubeconfig <pathToMgmtClusterKubeconfig> \
      --key-file <pathToRegionalClusterSshKey> --kubeconfig <pathToRegionalClusterKubeconfig> \
      --cluster-name <clusterName> --cluster-namespace <clusterProject>
    • For a managed cluster:

      kaas collect logs --management-kubeconfig <pathToMgmtClusterKubeconfig> \
      --key-file <pathToManagedClusterSshKey> --kubeconfig <pathToManagedClusterKubeconfig> \
      --cluster-name <clusterName> --cluster-namespace <clusterProject>

    Substitute the parameters enclosed in angle brackets with the corresponding values of your cluster.

    Optionally, add --output-dir that is a directory path to collect logs. The default value is logs/. For example, logs/<clusterName>/events.log.