GKE Pod snapshots are configured with two custom resource definitions (CRDs):

- [PodSnapshotStorageConfig](https://docs.cloud.google.com/kubernetes-engine/docs/reference/crds/podsnapshot.md.txt#podsnapshotstorageconfig)
- [PodSnapshotPolicy](https://docs.cloud.google.com/kubernetes-engine/docs/reference/crds/podsnapshot.md.txt#podsnapshotpolicy)

When snapshots are taken, the Pod state is represented by a [PodSnapshot](https://docs.cloud.google.com/kubernetes-engine/docs/reference/crds/podsnapshot.md.txt#podsnapshot) resource.
Each resource includes status fields that update when snapshots are taken,
which helps monitor operation success or failure.

To learn more about Pod snapshots, see [About Pod snapshots](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/pod-snapshots.md.txt).

## PodSnapshotStorageConfig specification

PodSnapshotStorageConfig defines where Pod snapshots are stored.

```yaml
spec:
  snapshotStorageConfig:
    gcs:
      bucket: string
      path: string
      tokenSource: string
```

| Fields ||
|---|---|
| `spec.snapshotStorageConfig` *required* | `object` Defines the configuration for the snapshot's underlying storage. |
| `spec.snapshotStorageConfig.gcs` *required* | `object` Contains the configuration for Cloud Storage setups. |
| `spec.snapshotStorageConfig.gcs.bucket` *required* | `string` Defines the bucket name to be used for storing Pod snapshots. |
| `spec.snapshotStorageConfig.gcs.path` *optional* | `string` Defines the path within the bucket to be used as a child directory for storing Pod snapshots. |
| `spec.snapshotStorageConfig.gcs.tokenSource` *optional* | `string` Defines the identity provider for access to Cloud Storage. Supported values are `podKSA` (default) and `federatedP4SA` (multi-tenancy). |

### Status

The `status` section indicates the observed state of the PodSnapshotStorageConfig resource.

| Fields ||
|---|---|
| `status.conditions` | `array (object)` List of status conditions for the storage configuration. |
| `status.observedGeneration` | `integer` The most recent generation observed by the controller. |

## PodSnapshotPolicy specification

PodSnapshotPolicy configures the Pod snapshot feature, such as the matching
conditions to trigger checkpoints for selected workloads.

```yaml
spec:
  selector:
    matchExpressions:
    - key: string
      operator: string
      values: []string
    matchLabels:
      additionalProperties: string
  storageConfigName: string
  snapshotScope: string
  triggerConfig:
    postCheckpoint: string
    type: string
  retentionConfig:
    lastAccessTimeout: string
  snapshotGroupingRules:
    groupByLabelValue:
      labels: []string
      groupRetentionPolicy:
        maxSnapshotCountPerGroup: int
```

| Fields ||
|---|---|
| `spec.selector` *required* | `object` Defines the set of Pods managed by this policy. The policy's checkpoint and restore settings will apply to all Pods that match the policy's label selector. |
| `spec.selector.matchExpressions` *optional* | `[]object` A list of label selector requirements. The requirements are combined by using an AND statement. |
| `spec.selector.matchExpressions[].key` *required* | `string` The label key that the selector applies to. |
| `spec.selector.matchExpressions[].operator` *required* | `string` Represents a key's relationship to a set of values. Valid operators are `In`, `NotIn`, `Exists`, and `DoesNotExist`. |
| `spec.selector.matchExpressions[].values` *optional* | `[]string` An array of string values. If the operator is `In` or `NotIn`, the values array must be non-empty. If the operator is `Exists` or `DoesNotExist`, the values array must be empty. |
| `spec.selector.matchLabels` *optional* | `object` A map of key-value pairs. A single key-value pair in the map is equivalent to an element of `matchExpressions`, whose key field is "key", the operator is `In`, and the values array contains only "value". The requirements are combined by using an AND statement. |
| `spec.storageConfigName` *required* | `string` Name of the PodSnapshotStorageConfig this policy depends on. |
| `spec.snapshotScope` *optional* | `string` Defines the scope of the snapshot. Supported values are `whole-pod` (default) to checkpoint the entire Pod including application state, application memory, and file systems, or `rootfs-only` to checkpoint only the container root file system. The `rootfs-only` scope is available in GKE version 1.35.3-gke.1031000 and later. |
| `spec.triggerConfig` *required* | `object` Configuration for checkpoint triggers. |
| `spec.triggerConfig.postCheckpoint` *optional* | `string` Defines Pod behavior after a checkpoint is taken. `stop`: the Pod turns to completed status. `resume`: the workload resumes after being checkpointed. Default is `resume`. > [!WARNING] > **Warning:** If your workload uses Persistent Volume Claims (PVCs), using `resume` might lead to restore failures if the workload modifies the volume after the checkpoint and the same volume is used during restore. See [Post-checkpoint mutation risks with PVCs](https://docs.cloud.google.com/kubernetes-engine/docs/troubleshooting/pod-snapshots.md.txt#post-checkpoint-mutations). |
| `spec.triggerConfig.type` *required* | `string` Type of checkpoint trigger. The following values are supported: - `workload`: triggered by the application inside the Pod signaling to the GKE agent. - `manual`: triggered by the creation of a `PodSnapshotManualTrigger` custom resource. |
| `spec.retentionConfig` *optional* | `object` Configuration for Pod snapshot retention policy. If not set, the Pod snapshot will always persist unless manually deleted. |
| `spec.retentionConfig.lastAccessTimeout` *required* | `string` Duration after which a Pod snapshot will be considered stale and deleted automatically. Supported units are `y`, `mo`, `d`, `h`, and `min`. |
| `spec.snapshotGroupingRules` *optional* | `object` Configuration for defining the Pod snapshot groups. This field is available in GKE version 1.35.0-gke.3047000 and later. |
| `spec.snapshotGroupingRules.groupByLabelValue` *required* | `object` Configuration for defining the grouping mechanism for Pod snapshots. |
| `spec.snapshotGroupingRules.groupByLabelValue.labels` *required* | `[]string` An array of string values indicating the Pod labels used for grouping. Labels defined in this field must be present on the workload Pod when the snapshot is taken or restored. |
| `spec.snapshotGroupingRules.groupByLabelValue.groupRetentionPolicy` *optional* | `object` Configuration for defining the snapshot retention configuration per group. |
| `spec.snapshotGroupingRules.groupByLabelValue.groupRetentionPolicy.maxSnapshotCountPerGroup` *required* | `int` The maximum number of snapshots retained per group. If the number of Pod snapshots in a group exceed this number, they are automatically deleted, starting with the oldest snapshot, until the count reaches this number. Setting `0` as the value for this option lifts the restriction on snapshot retention. |

### Status

The `status` section indicates the observed state of the PodSnapshotPolicy resource.

| Fields ||
|---|---|
| `status.conditions` | `array (object)` List of status conditions for the snapshot policy. |
| `status.observedGeneration` | `integer` The most recent generation observed by the controller. |

## PodSnapshotManualTrigger specification

PodSnapshotManualTrigger signals when to take a snapshot of a specified Pod.

```yaml
spec:
  targetPod: string
```

| Fields ||
|---|---|
| `spec.targetPod` *required* | `string` Name of the Pod to take a snapshot of. |

### Status

The `status` section indicates the state of the manual trigger operation.

| Fields ||
|---|---|
| `status.conditions` | `array (object)` List of status conditions for the manual trigger, such as whether the checkpoint was successful. |
| `status.observedGeneration` | `integer` The most recent generation observed by the controller. |
| `status.snapshotCreated` | `string` The name of the PodSnapshot resource created as a result of this trigger. |

## PodSnapshot specification

PodSnapshot represents a point-in-time snapshot of a Pod's state.
It is governed by the PodSnapshotPolicy. You can't create or update
PodSnapshot directly. GKE automatically creates and
manages these resources.

```yaml
spec:
  policyName: string
```

| Fields ||
|---|---|
| `spec.policyName` *required* | `string` The name of the PodSnapshotPolicy in the same namespace that governs the behavior of this snapshot. This field is immutable. |

### Status

The `status` section indicates whether a snapshot operation succeeded or failed
and provides metadata about the snapshot.

| Fields ||
|---|---|
| `status.conditions` | `array (object)` List of status conditions for the snapshot operation. |
| `status.lastAccessTime` | `string` The last time this snapshot was used to restore a Pod. |
| `status.observedCheckpointRetryCount` | `integer` The current retry attempt count for this snapshotting operation. |
| `status.observedGeneration` | `integer` The most recent generation observed by the controller. |
| `status.storageStatus.gcs.observedGCSPath` | `string` The Cloud Storage path where the snapshot data resides. |