The SECRET[alias.key] mechanism replaces the placeholder with the content of the secret key. Because the operator publishes the configuration as JSON, the secret value must be valid within a JSON string.
Unsupported Values
The following values will cause the pipeline to be marked invalid:
- Non-UTF-8: Must be valid UTF-8.
- Double Quotes (
"): These prematurely close the JSON string. - Backslashes (
\): These can break parsing or create unintended escape sequences. - Raw Control Bytes: Any bytes in the range
0x00–0x1F.
Best Practices
- Use for single-line credentials: This feature is ideal for passwords, tokens, usernames, and connection strings.
- Avoid for multi-line material: Do not use
spec.secret for certificates or private keys. Instead, mount these as files using standard Kubernetes volumes and volumeMounts on the Vector CR, and use the file path options in your sink (e.g., ca_file, crt_file).
Example: Using files for TLS and secrets for SASL
sinks:
out:
type: kafka
inputs: [logs]
bootstrap_servers: "kafka.example.com:9093"
auth:
tls:
enabled: true
# Mounted via standard volumes/volumeMounts on the Vector CR
ca_file: /etc/vector/tls/ca.crt
sasl:
enabled: true
mechanism: SCRAM-SHA-512
username: "SECRET[kafka.username]"
password: "SECRET[kafka.password]"