You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can read authentication parameters from files mounted in the KEDA operator pod using the `filePath` option. This feature requires the KEDA operator to be configured with a root path for file access.
6
+
7
+
## Security Constraints
8
+
9
+
The `filePath` feature has important security constraints:
10
+
11
+
-**Requires root path configuration** - The KEDA operator must be started with `--filepath-auth-root-path` to define the allowed directory
12
+
-**Path validation** - All file paths are validated to ensure they resolve within the configured root path, preventing access to sensitive system files like service account tokens
13
+
-**Relative paths** - The `filePath` in `ClusterTriggerAuthentication` is treated as a relative path under the configured root path
14
+
15
+
## Operator Configuration
16
+
17
+
The KEDA operator requires a command-line argument to enable file-based authentication:
18
+
19
+
```bash
20
+
--filepath-auth-root-path=/path/to/allowed/files
21
+
```
22
+
23
+
This path should point to a directory where credential files are mounted. The operator will only read files from within this directory.
24
+
25
+
## Example
26
+
27
+
First, ensure the KEDA operator has the root path configured. Then create a `ClusterTriggerAuthentication` referencing files:
28
+
29
+
```yaml
30
+
apiVersion: keda.sh/v1alpha1
31
+
kind: ClusterTriggerAuthentication
32
+
metadata:
33
+
name: file-based-auth
34
+
spec:
35
+
filePath:
36
+
- parameter: apiKey # Required - Defined by the scale trigger
37
+
path: credentials/api-key # Required - Path relative to filepath-auth-root-path
38
+
```
39
+
40
+
**Assumptions:**
41
+
- The path is relative to the `--filepath-auth-root-path` configured for the KEDA operator
42
+
- The credential file exists at `{filepath-auth-root-path}/credentials/api-key`
43
+
- The file contains the raw credential value (not JSON encoded)
44
+
- The file path should match the actual file name, including any extension if present (e.g., `credentials/api-key.txt` if the file is named `api-key.txt`)
path: {relative-path-to-file} # Required. Relative to --filepath-auth-root-path.
107
110
hashiCorpVault: # Optional.
108
111
address: {hashicorp-vault-address} # Required.
109
112
namespace: {hashicorp-vault-namespace} # Optional. Default is root namespace. Useful for Vault Enterprise
@@ -241,6 +244,30 @@ secretTargetRef: # Optional.
241
244
242
245
**Assumptions:** `namespace` is in the same resource as referenced by `scaleTargetRef.name` in the ScaledObject, unless specified otherwise.
243
246
247
+
### File(s)
248
+
249
+
> **Note:** This feature requires the KEDA operator to be configured with `--filepath-auth-root-path`.
250
+
251
+
You can read authentication parameters from files mounted in the KEDA operator pod. This is useful when credentials are provided via init containers or sidecars that write to a shared volume.
252
+
253
+
The `filePath` option is only available for `ClusterTriggerAuthentication`, not for namespaced `TriggerAuthentication`.
254
+
255
+
```yaml
256
+
filePath: # Optional.
257
+
- parameter: apiKey # Required - Defined by the scale trigger
258
+
path: credentials/api-key # Required - Path relative to filepath-auth-root-path
259
+
```
260
+
261
+
**Security constraints:**
262
+
- The path is validated to ensure it resolves within the configured `--filepath-auth-root-path`
263
+
- Access to sensitive paths like `/var/run/secrets/kubernetes.io/serviceaccount/` is blocked
264
+
- Only `ClusterTriggerAuthentication` can use this authentication method
265
+
266
+
**Assumptions:**
267
+
- The KEDA operator must be started with `--filepath-auth-root-path=/path/to/allowed/files`
268
+
- The credential file exists at `{filepath-auth-root-path}/{path}`
269
+
- The file contains the raw credential value
270
+
244
271
### Bound service account token(s)
245
272
246
273
You can pull one or more service account tokens into the trigger by defining the `serviceAccountName` of the Kubernetes service account.
0 commit comments