Key Concepts
Hierarchical Structure
Organize keys into folders using path separators. Navigate like a filesystem.
Multiple Formats
Store plain text, JSON, or YAML values with syntax highlighting and validation.
Version Tracking
Every key has create, modify, and lock indexes for tracking changes.
Atomic Operations
Consul ensures atomic read and write operations for consistency.
Required Permissions
| Action | Permission |
|---|---|
| View/Read keys | iam:project:cicd:consul:read |
| Create/Update keys | iam:project:cicd:consul:write |
| Delete keys/folders | iam:project:cicd:consul:delete |
Keys vs Folders
| Item | Description | Example |
|---|---|---|
| Key | Stores a value (string, JSON, YAML) | config/database |
| Folder | Organizes keys hierarchically (ends with /) | config/app/ |
How to Navigate the KV Store
How to Create a Key
Select Format (for Keys)
Choose the value format:
- Plain Text: Simple string values
- JSON: Structured data with validation
- YAML: Configuration files
How to View and Edit a Key
Review Key Information
The detail page displays the key’s indexes (create, modify, lock) and flags for tracking changes.
How to Copy a Value
- Open the key detail page
- Click the Copy button in the toolbar
- The entire value is copied to your clipboard
How to Hide/Show Values
For sensitive data:- Click the eye icon to hide the value
- The editor is replaced with a “Value is hidden” placeholder
- Click Show Value to reveal it again
How to Delete a Key
How to Delete a Folder
Path Conventions
Follow these conventions for organizing keys:Common Use Cases
Application Configuration
Store database connections, API endpoints, and feature flags:Service Discovery Configuration
Store service metadata that applications can read:Feature Flags
Simple key-value pairs for feature toggles:Troubleshooting
Key not appearing after creation
Key not appearing after creation
- Click the refresh button to reload the key list
- Verify you’re in the correct folder path
- Check that the key was created successfully (look for error messages)
Cannot edit key
Cannot edit key
- You need write permission for Consul KV
- The Consul instance may be in read-only mode
- Check network connectivity to Consul
JSON validation error
JSON validation error
- Check for missing commas between key-value pairs
- Ensure all strings are wrapped in double quotes
- Verify brackets and braces are properly matched
- Use an external JSON validator if needed
Cannot delete folder
Cannot delete folder
- You need delete permission for Consul KV
- Ensure the folder path is correct
- Try deleting individual keys first if bulk delete fails
Changes not persisting
Changes not persisting
- Click Save Changes after editing
- Check for validation errors (invalid JSON badge)
- Verify you have write permissions
- Refresh and check if another process is overwriting
FAQ
What's the maximum value size?
What's the maximum value size?
Consul has a default limit of 512KB per key-value entry. This can be configured on the Consul server. For larger data, consider using external storage and storing only references in Consul.
Can I store binary data?
Can I store binary data?
Consul KV stores values as base64-encoded strings. While you can store binary data, the UI works best with text-based formats (plain text, JSON, YAML). For binary files, consider dedicated storage solutions.
Are changes immediately visible to applications?
Are changes immediately visible to applications?
Yes. Consul KV changes are immediately available to all clients. Applications using Consul watches or blocking queries will be notified of changes.
What are flags used for?
What are flags used for?
Flags are a 64-bit unsigned integer associated with each key. Applications can use them for versioning, tagging, or any custom purpose. The UI preserves flags when updating values.
How do I back up KV data?
How do I back up KV data?
Use the Consul CLI:
consul kv export > backup.json. You can also use the HTTP API for programmatic backups. Consider regular snapshots for disaster recovery.Can multiple users edit the same key?
Can multiple users edit the same key?
Yes, but the last write wins. Consul supports Check-and-Set (CAS) operations for optimistic locking. The modify index can be used to detect conflicts.
What's the difference between create and modify index?
What's the difference between create and modify index?
Create Index is set when the key is first created and never changes. Modify Index updates on every write. Use these for change detection and caching strategies.
Best Practices
Organize by Environment
Keep environment-specific configurations separate:Use Meaningful Names
Name keys descriptively:Prefer JSON for Structured Data
JSON provides validation and is widely supported:Document Key Purpose
Use consistent naming that indicates purpose:Avoid Sensitive Data
Consul KV is not designed for secrets. Use HashiCorp Vault for:- Passwords
- API keys
- Certificates
- Any sensitive credentials