Retrieving cluster information

This document describes how to use the bmctl get command to retrieve important configuration and credential information for your existing clusters. This information can be helpful in troubleshooting cluster problems.

Getting cluster configuration details

After you create admin, hybrid, standalone, or user clusters with the bmctl get config command.

Use the following command to retrieve all custom resources for a self-managing cluster, such as an admin cluster:

bmctl get config --cluster CLUSTER_NAME  --kubeconfig ADMIN_KUBECONFIG_PATH

Replace the following:

  • CLUSTER_NAME: the name of the target cluster.

  • ADMIN_KUBECONFIG_PATH: the path to the admin cluster kubeconfig file.

Use the following command to retrieve all custom resources for a user cluster:

Note that bmctl supports the use of --kubeconfig as an alias for the --admin-kubeconfig flag.

bmctl get config --cluster CLUSTER_NAME --admin-kubeconfig ADMIN_KUBECONFIG_PATH

Replace the following:

  • CLUSTER_NAME: the name of the target user cluster.

  • ADMIN_KUBECONFIG_PATH: the path to the admin cluster kubeconfig file.

In either case, the custom resources are written to a YAML file, bmctl-workspace/CLUSTER_NAME/CLUSTER_NAME-TIMESTAMP.yaml. The TIMESTAMP in the file name indicates the date and time the file was created.

The YAML file produced by the bmctl get config command will look something like this:

---
apiVersion: v1
kind: Namespace
metadata:
 name: cluster-admin1
---
apiVersion: baremetal.cluster.gke.io/v1
kind: Cluster
metadata:
 name: admin1
 namespace: cluster-admin1
spec:
 clusterNetwork:
   services:
     cidrBlocks:
     - 10.96.0.0/20
   pods:
     cidrBlocks:
     - 192.168.0.0/16
 controlPlane:
   nodePoolSpec:
     nodes:
     - address: 172.18.0.13
 loadBalancer:
   mode: bundled
   ports:
     controlPlaneLBPort: 6443
   vips:
     controlPlaneVIP: 172.18.0.254
 storage:
   lvpShare:
     path: /mnt/localpv-share/
     storageclassname: standard
     numpvundersharedpath: 5
   lvpNodeMounts:
     path: /mnt/localpv-disk
     storageclassname: node-disk
 authentication:
   oidc:
     issuerURL: https://accounts.google.com
     kubectlRedirectURL: http://localhost:9879/callback
     clientID: 611080206796-9qq355g2q1coed5t78ckfmm1c6ini3et.apps.googleusercontent.com
     clientSecret: FTPbx3INYJcxBSQhMRlbk3tX
     username: email
     scopes: email
     extraParams: prompt=consent,access_type=offline
 clusterOperations:
   projectID: baremetal-test
   location: us-central1
 type: admin
 anthosBareMetalVersion: 0.0.0
 bypassPreflightCheck: false
 nodeConfig:
   containerRuntime: docker
---
apiVersion: baremetal.cluster.gke.io/v1
kind: NodePool
metadata:
 name: nodepool1
 namespace: cluster-admin1
spec:
 clusterName: admin1
 nodes:
 - address: 172.18.0.9

Getting cluster credentials

Use the bmctl get credentials command to retrieve credentials for a given user cluster.

Use the following command to retrieve all custom resources for a user cluster:

Note that bmctl supports the use of --kubeconfig as an alias for the --admin-kubeconfig flag.

bmctl get credentials --cluster CLUSTER_NAME --admin-kubeconfig ADMIN_KUBECONFIG_PATH

Replace the following:

  • CLUSTER_NAME: the name of the target user cluster.

  • ADMIN_KUBECONFIG_PATH: the path to the admin cluster kubeconfig file.

In either case, the cluster's credentials are written to a file, bmctl-workspace/CLUSTER_NAME/CLUSTER_NAME-TIMESTAMP-kubeconfig. The TIMESTAMP in the file name indicates the date and time the file was created.

Because this file contains authentication credentials for your cluster, you should store it in a secure location with restricted access.