> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infraudit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# infraudit kubernetes — Kubernetes cluster commands

> infraudit kubernetes list, scan, resources — register clusters and inspect workloads. Key flags: --name, --kubeconfig. Alias: k8s for shorter commands.

The `kubernetes` command group (alias: `k8s`) manages Kubernetes cluster connections and lets you inspect workloads, namespaces, pods, services, and resource statistics.

## `kubernetes list`

List all registered Kubernetes clusters:

```bash theme={null}
infraudit kubernetes list
infraudit k8s clusters
```

Example output:

```
ID  NAME         STATUS   NODES   NAMESPACES   LAST SYNC
--  ----         ------   -----   ----------   ---------
1   production   active   5       12           3 minutes ago
2   staging      active   2       8            1 hour ago
```

## `kubernetes register`

Register a Kubernetes cluster using a kubeconfig file:

```bash theme={null}
infraudit k8s register --name production --kubeconfig ~/.kube/config
```

| Flag           | Description                  |
| -------------- | ---------------------------- |
| `--name`       | Display name for the cluster |
| `--kubeconfig` | Path to the kubeconfig file  |

## `kubernetes scan`

Run a security and configuration scan against a registered cluster:

**Synopsis:**

```bash theme={null}
infraudit kubernetes scan <cluster-id>
infraudit k8s scan <cluster-id>
```

Example:

```bash theme={null}
infraudit kubernetes scan 1
```

## `kubernetes sync`

Sync the resource inventory for a cluster:

```bash theme={null}
infraudit k8s sync 1
```

## `kubernetes resources`

List all resources in a cluster:

**Synopsis:**

```bash theme={null}
infraudit kubernetes resources <cluster-id>
```

Example:

```bash theme={null}
infraudit kubernetes resources 1
```

## Workload inspection

The following subcommands let you inspect specific resource types within a cluster:

### Namespaces

```bash theme={null}
infraudit k8s namespaces 1
```

### Deployments

```bash theme={null}
infraudit k8s deployments 1
```

### Pods

```bash theme={null}
infraudit k8s pods 1
```

### Services

```bash theme={null}
infraudit k8s services 1
```

### Cluster stats

Show an aggregate summary of resource counts and health across all clusters:

```bash theme={null}
infraudit k8s stats
```

## `kubernetes delete`

Remove a cluster from InfraAudit. Historical data is retained; the cluster is no longer scanned:

```bash theme={null}
infraudit k8s delete 1
```

<Note>
  Registering a Kubernetes cluster requires that InfraAudit can reach the cluster API server from wherever the CLI is running. In-cluster deployments may require additional network configuration.
</Note>
