|
| 1 | +# Cloud Storage for Snapshots |
| 2 | + |
| 3 | +Kubeshark can upload and download snapshots to cloud object storage, enabling cross-cluster sharing, backup/restore, and long-term retention. |
| 4 | + |
| 5 | +Supported providers: **Amazon S3** (`s3`) and **Azure Blob Storage** (`azblob`). |
| 6 | + |
| 7 | +## Helm Values |
| 8 | + |
| 9 | +```yaml |
| 10 | +tap: |
| 11 | + snapshots: |
| 12 | + cloud: |
| 13 | + provider: "" # "s3" or "azblob" (empty = disabled) |
| 14 | + configMaps: [] # names of pre-existing ConfigMaps with cloud config env vars |
| 15 | + secrets: [] # names of pre-existing Secrets with cloud credentials |
| 16 | +``` |
| 17 | +
|
| 18 | +- `provider` selects which cloud backend to use. Leave empty to disable cloud storage. |
| 19 | +- `configMaps` and `secrets` are lists of names of existing ConfigMap/Secret resources. They are mounted as `envFrom` on the hub pod, injecting all their keys as environment variables. |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Amazon S3 |
| 24 | + |
| 25 | +### Environment Variables |
| 26 | + |
| 27 | +| Variable | Required | Description | |
| 28 | +|----------|----------|-------------| |
| 29 | +| `SNAPSHOT_AWS_BUCKET` | Yes | S3 bucket name | |
| 30 | +| `SNAPSHOT_AWS_REGION` | No | AWS region (uses SDK default if empty) | |
| 31 | +| `SNAPSHOT_AWS_ACCESS_KEY` | No | Static access key ID (empty = use default credential chain) | |
| 32 | +| `SNAPSHOT_AWS_SECRET_KEY` | No | Static secret access key | |
| 33 | +| `SNAPSHOT_AWS_ROLE_ARN` | No | IAM role ARN to assume via STS (for cross-account access) | |
| 34 | +| `SNAPSHOT_AWS_EXTERNAL_ID` | No | External ID for the STS AssumeRole call | |
| 35 | +| `SNAPSHOT_CLOUD_PREFIX` | No | Key prefix in the bucket (e.g. `snapshots/`) | |
| 36 | + |
| 37 | +### Authentication Methods |
| 38 | + |
| 39 | +Credentials are resolved in this order: |
| 40 | + |
| 41 | +1. **Static credentials** -- If `SNAPSHOT_AWS_ACCESS_KEY` is set, static credentials are used directly. |
| 42 | +2. **STS AssumeRole** -- If `SNAPSHOT_AWS_ROLE_ARN` is also set, the static (or default) credentials are used to assume the given IAM role. This is useful for cross-account S3 access. |
| 43 | +3. **AWS default credential chain** -- When no static credentials are provided, the SDK default chain is used: |
| 44 | + - **IRSA** (EKS service account token) -- recommended for production on EKS |
| 45 | + - EC2 instance profile |
| 46 | + - Standard AWS environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, etc.) |
| 47 | + - Shared credentials file (`~/.aws/credentials`) |
| 48 | + |
| 49 | +The provider validates bucket access on startup via `HeadBucket`. If the bucket is inaccessible, the hub will fail to start. |
| 50 | + |
| 51 | +### Example: IRSA (recommended for EKS) |
| 52 | + |
| 53 | +Create a ConfigMap with bucket configuration: |
| 54 | + |
| 55 | +```yaml |
| 56 | +apiVersion: v1 |
| 57 | +kind: ConfigMap |
| 58 | +metadata: |
| 59 | + name: kubeshark-s3-config |
| 60 | +data: |
| 61 | + SNAPSHOT_AWS_BUCKET: my-kubeshark-snapshots |
| 62 | + SNAPSHOT_AWS_REGION: us-east-1 |
| 63 | +``` |
| 64 | + |
| 65 | +Set Helm values: |
| 66 | + |
| 67 | +```yaml |
| 68 | +tap: |
| 69 | + snapshots: |
| 70 | + cloud: |
| 71 | + provider: "s3" |
| 72 | + configMaps: |
| 73 | + - kubeshark-s3-config |
| 74 | +``` |
| 75 | + |
| 76 | +The hub pod's service account must be annotated for IRSA with an IAM role that has S3 access to the bucket. |
| 77 | + |
| 78 | +### Example: Static Credentials |
| 79 | + |
| 80 | +Create a Secret with credentials: |
| 81 | + |
| 82 | +```yaml |
| 83 | +apiVersion: v1 |
| 84 | +kind: Secret |
| 85 | +metadata: |
| 86 | + name: kubeshark-s3-creds |
| 87 | +type: Opaque |
| 88 | +stringData: |
| 89 | + SNAPSHOT_AWS_ACCESS_KEY: AKIA... |
| 90 | + SNAPSHOT_AWS_SECRET_KEY: wJal... |
| 91 | +``` |
| 92 | + |
| 93 | +Create a ConfigMap with bucket configuration: |
| 94 | + |
| 95 | +```yaml |
| 96 | +apiVersion: v1 |
| 97 | +kind: ConfigMap |
| 98 | +metadata: |
| 99 | + name: kubeshark-s3-config |
| 100 | +data: |
| 101 | + SNAPSHOT_AWS_BUCKET: my-kubeshark-snapshots |
| 102 | + SNAPSHOT_AWS_REGION: us-east-1 |
| 103 | +``` |
| 104 | + |
| 105 | +Set Helm values: |
| 106 | + |
| 107 | +```yaml |
| 108 | +tap: |
| 109 | + snapshots: |
| 110 | + cloud: |
| 111 | + provider: "s3" |
| 112 | + configMaps: |
| 113 | + - kubeshark-s3-config |
| 114 | + secrets: |
| 115 | + - kubeshark-s3-creds |
| 116 | +``` |
| 117 | + |
| 118 | +### Example: Cross-Account Access via AssumeRole |
| 119 | + |
| 120 | +Add the role ARN to your ConfigMap: |
| 121 | + |
| 122 | +```yaml |
| 123 | +apiVersion: v1 |
| 124 | +kind: ConfigMap |
| 125 | +metadata: |
| 126 | + name: kubeshark-s3-config |
| 127 | +data: |
| 128 | + SNAPSHOT_AWS_BUCKET: other-account-bucket |
| 129 | + SNAPSHOT_AWS_REGION: eu-west-1 |
| 130 | + SNAPSHOT_AWS_ROLE_ARN: arn:aws:iam::123456789012:role/KubesharkCrossAccountRole |
| 131 | + SNAPSHOT_AWS_EXTERNAL_ID: my-external-id # optional, if required by the trust policy |
| 132 | +``` |
| 133 | + |
| 134 | +The hub will first authenticate using its own credentials (IRSA, static, or default chain), then assume the specified role to access the bucket. |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## Azure Blob Storage |
| 139 | + |
| 140 | +### Environment Variables |
| 141 | + |
| 142 | +| Variable | Required | Description | |
| 143 | +|----------|----------|-------------| |
| 144 | +| `SNAPSHOT_AZBLOB_STORAGE_ACCOUNT` | Yes | Azure storage account name | |
| 145 | +| `SNAPSHOT_AZBLOB_CONTAINER` | Yes | Blob container name | |
| 146 | +| `SNAPSHOT_AZBLOB_STORAGE_KEY` | No | Storage account access key (empty = use DefaultAzureCredential) | |
| 147 | +| `SNAPSHOT_CLOUD_PREFIX` | No | Key prefix in the container (e.g. `snapshots/`) | |
| 148 | + |
| 149 | +### Authentication Methods |
| 150 | + |
| 151 | +Credentials are resolved in this order: |
| 152 | + |
| 153 | +1. **Shared Key** -- If `SNAPSHOT_AZBLOB_STORAGE_KEY` is set, the storage account key is used directly. |
| 154 | +2. **DefaultAzureCredential** -- When no storage key is provided, the Azure SDK default credential chain is used: |
| 155 | + - **Workload Identity** (AKS pod identity) -- recommended for production on AKS |
| 156 | + - Managed Identity (system or user-assigned) |
| 157 | + - Azure CLI credentials |
| 158 | + - Environment variables (`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`) |
| 159 | + |
| 160 | +The provider validates container access on startup via `GetProperties`. If the container is inaccessible, the hub will fail to start. |
| 161 | + |
| 162 | +### Example: Workload Identity (recommended for AKS) |
| 163 | + |
| 164 | +Create a ConfigMap with storage configuration: |
| 165 | + |
| 166 | +```yaml |
| 167 | +apiVersion: v1 |
| 168 | +kind: ConfigMap |
| 169 | +metadata: |
| 170 | + name: kubeshark-azblob-config |
| 171 | +data: |
| 172 | + SNAPSHOT_AZBLOB_STORAGE_ACCOUNT: mykubesharksa |
| 173 | + SNAPSHOT_AZBLOB_CONTAINER: snapshots |
| 174 | +``` |
| 175 | + |
| 176 | +Set Helm values: |
| 177 | + |
| 178 | +```yaml |
| 179 | +tap: |
| 180 | + snapshots: |
| 181 | + cloud: |
| 182 | + provider: "azblob" |
| 183 | + configMaps: |
| 184 | + - kubeshark-azblob-config |
| 185 | +``` |
| 186 | + |
| 187 | +The hub pod's service account must be configured for AKS Workload Identity with a managed identity that has the **Storage Blob Data Contributor** role on the container. |
| 188 | + |
| 189 | +### Example: Storage Account Key |
| 190 | + |
| 191 | +Create a Secret with the storage key: |
| 192 | + |
| 193 | +```yaml |
| 194 | +apiVersion: v1 |
| 195 | +kind: Secret |
| 196 | +metadata: |
| 197 | + name: kubeshark-azblob-creds |
| 198 | +type: Opaque |
| 199 | +stringData: |
| 200 | + SNAPSHOT_AZBLOB_STORAGE_KEY: "base64-encoded-storage-key..." |
| 201 | +``` |
| 202 | + |
| 203 | +Create a ConfigMap with storage configuration: |
| 204 | + |
| 205 | +```yaml |
| 206 | +apiVersion: v1 |
| 207 | +kind: ConfigMap |
| 208 | +metadata: |
| 209 | + name: kubeshark-azblob-config |
| 210 | +data: |
| 211 | + SNAPSHOT_AZBLOB_STORAGE_ACCOUNT: mykubesharksa |
| 212 | + SNAPSHOT_AZBLOB_CONTAINER: snapshots |
| 213 | +``` |
| 214 | + |
| 215 | +Set Helm values: |
| 216 | + |
| 217 | +```yaml |
| 218 | +tap: |
| 219 | + snapshots: |
| 220 | + cloud: |
| 221 | + provider: "azblob" |
| 222 | + configMaps: |
| 223 | + - kubeshark-azblob-config |
| 224 | + secrets: |
| 225 | + - kubeshark-azblob-creds |
| 226 | +``` |
0 commit comments