The PodSnapshotPolicy custom resource defines the following snapshot behavior:
- Which Pods Google Kubernetes Engine (GKE) takes snapshots of.
- What triggers a snapshot.
- Where GKE stores snapshots.
- How long GKE retains snapshots.
A policy references a PodSnapshotStorageConfig for storage, and GKE creates a PodSnapshot for each snapshot that the policy produces.
For more information, see About GKE Pod snapshots.
PodSnapshotPolicy specification
The following code shows the PodSnapshotPolicy specification:
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
The following table describes the fields in the PodSnapshotPolicy specification:
| Fields | |
|---|---|
|
required |
The set of Pods that this policy manages. The policy's snapshot and restore settings apply to all Pods that match the policy's label selector. |
|
optional |
A list of label selector requirements. GKE combines the requirements with a logical AND. |
|
required |
The label key that the selector applies to. |
|
required |
The relationship between the key and a set of values. Valid operators are |
|
optional |
An array of string values. If the operator is |
|
optional |
A map of key-value pairs. Each pair is equivalent to a |
|
required |
The name of the PodSnapshotStorageConfig that this policy uses to store snapshots. |
|
optional |
The scope of the snapshot. The following values are supported:
|
|
required |
The configuration for snapshot triggers. |
|
optional |
The behavior of the Pod after GKE takes a snapshot. The following values are supported:
|
|
required |
The type of snapshot trigger. The following values are supported:
|
|
optional |
The retention policy for Pod snapshots. If you don't specify a retention policy, then the Pod snapshot persists until you manually delete it. |
|
required |
The duration of inactivity after which GKE considers
the snapshot stale and automatically deletes it. Supported units are
|
|
optional |
The rules that GKE uses to group Pod snapshots. This field is available in GKE version 1.35.0-gke.3047000 and later. |
|
required |
Groups Pod snapshots by the values of the specified Pod labels. |
|
required |
The Pod label keys that GKE uses to group snapshots. Any matching labels on the source Pod are copied to the PodSnapshot, and a restored Pod must have matching label keys and values to restore from that group. |
|
optional |
The retention policy for each snapshot group. |
|
optional |
The maximum number of snapshots that GKE retains per group. If the number of Pod snapshots in a group exceeds this value, then GKE automatically deletes the oldest snapshots until the count reaches this value. The default value is |
PodSnapshotPolicy status
The status section indicates the observed state of the PodSnapshotPolicy.
The following table describes the fields in the status section:
| Fields | |
|---|---|
status.conditions |
List of status conditions for the snapshot policy. |
status.observedGeneration |
The most recent generation that the controller observed. |