Response Protocol
Complete guide for creating and managing Response Protocol
Response Protocols are a sequence of steps designed to handle Kubernetes operations and gain insights into incidents within the cluster. They can be defined through YAML configuration or managed via the Agentkube dashboard. This documentation explains the structure and components of a Response Protocol YAML file.
Quickstart
Here’s a quick sample of a Response Protocol that you can import into your Agentkube dashboard to get started. Use this as a foundation to create your own custom protocol based on your cluster’s needs: Kubernetes Resource Health Check Protocol
Response Protocols can be created in two ways:
- YAML File Import: Create and import YAML files following the structure defined in this documentation
- Agentkube Dashboard: Use the intuitive web interface in the Agentkube dashboard to create and manage protocols without writing YAML manually
This guide focuses on the YAML file structure for users who prefer to create or manage protocols programmatically.
File Structure
Root Level Properties
The name of the response protocol
A detailed description of the protocol’s purpose
An array of step objects defining the protocol workflow
Step Object Properties
Each step in the steps
array has the following properties:
The title of the step
The step number (must be unique and sequential)
Detailed description of the step
Array of command objects to be executed
Array of next step objects defining workflow transitions
Command Object Properties
Each command in the commands
array has the following properties:
The actual command to be executed
Documentation describing the command’s purpose
Example usage of the command
If true, command cannot be modified (default: false)
NextStep Object Properties
Each object in the nextSteps
array has the following properties:
Type of reference: “STEP”, “FINAL”, or “STOP”
Required when referenceType is “STEP”
Array of condition strings
If true, conditions are ignored (default: false)
Reference Types
The referenceType
field can have one of three values:
STEP
: Proceed to another step (requires targetStepNumber)FINAL
: End the protocol successfullySTOP
: Terminate the protocol
Conditions
Conditions are expressions that determine when a next step should be taken. In the Kubernetes example, conditions are written in natural language for clarity:
- “If any pods are in CrashLoopBackOff status, investigate pod logs”
- “If LoadBalancer services show pending external IPs, check cloud provider integration”
- “If all resources are healthy and properly configured”
Example Usage
Best Practices
Step Numbers
Sequential Numbering
Use sequential numbers starting from 1, as shown in the Kubernetes example (1 through 4)
Uniqueness
Ensure numbers are unique within the protocol
Commands
Documentation
Use clear, descriptive docStrings that explain the command’s purpose
Examples
Provide practical examples with useful flags, like sorting and output formatting:
Access Control
Use readOnly flag appropriately to control command modification
Next Steps
Flow Definition
Define clear transitions between steps using conditions
Conditions
Use clear, actionable conditions that guide the operator
Terminal States
Include both FINAL (success) and STOP (critical issues) states
Common Workflow Patterns
Linear Workflow
Conditional Branching
Terminal Step
Error Handling
YAML Parser Validation
The YAML parser validates:
- Required fields are present
- Field types are correct
- Step numbers are unique
- Referenced steps exist
- Reference types are valid
Common errors to watch for:
- Missing required fields
- Invalid reference types
- Missing target step numbers for STEP references
- Duplicate step numbers
- Invalid YAML syntax
Testing
Syntax Validation
Validate YAML syntax
Path Testing
Test all possible paths through the workflow:
- Normal flow (all healthy)
- Error conditions (pod crashes, service issues)
- Terminal conditions (both FINAL and STOP)
Command Testing
Verify all kubectl commands work as expected
Error Handling
Test error scenarios and condition handling