The `bmctl get` command lets you retrieve configuration and credentials for your
existing clusters. This information helps you troubleshoot cluster issues.

## Get cluster configuration details

After you create
[admin](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/admin-cluster-creation.md.txt),
[hybrid](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/hybrid-cluster-creation.md.txt),
[standalone](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/standalone-cluster-creation.md.txt),
or [user](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/user-cluster-creation.md.txt)
clusters you can use the `bmctl get config` command to retrieve the cluster
configuration details.

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

```bash
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.

```bash
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.

For both commands, the custom resources are written to a YAML file named:
`bmctl-workspace/CLUSTER_NAME/CLUSTER_NAME-TIMESTAMP.yaml`.
The <var translate="no">TIMESTAMP</var> in the filename indicates the date and time the file
was created.

The YAML file produced by the `bmctl get config` command looks similar to the
following example:

```yaml
---
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
---
apiVersion: baremetal.cluster.gke.io/v1
kind: NodePool
metadata:
 name: nodepool1
 namespace: cluster-admin1
spec:
 clusterName: admin1
 nodes:
 - address: 172.18.0.9
```

## Get cluster credentials

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

To retrieve all custom resources for a user cluster, use the following command:

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

```bash
bmctl get credentials --cluster CLUSTER_NAME  \
    --admin-kubeconfig ADMIN_KUBECONFIG_PATH
```

Replace the following:

- <var translate="no">CLUSTER_NAME</var>: the name of the target user cluster.

- <var translate="no">ADMIN_KUBECONFIG_PATH</var>: the path to the admin cluster `kubeconfig`
  file.

The cluster's credentials are written to a file,
`bmctl-workspace/CLUSTER_NAME/CLUSTER_NAME-TIMESTAMP-kubeconfig`.
The <var translate="no">TIMESTAMP</var> in the filename 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.

## What's next

If you need additional assistance, reach out to

[Cloud Customer Care](https://cloud.google.com/support-hub).
You can also see
[Getting support](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/getting-support.md.txt) for more information about support resources, including the following:

- [Requirements](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/getting-support.md.txt#intro-support) for opening a support case.
- [Tools](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/getting-support.md.txt#support-tools) to help you troubleshoot, such as your environment configuration, logs, and metrics.
- Supported [components](https://docs.cloud.google.com/kubernetes-engine/distributed-cloud/bare-metal/docs/getting-support.md.txt#what-we-support).