Skip to content

Commit dca640c

Browse files
authored
Merge pull request #9 from frezes/feat/holmegpt
upgrade holmesgpt to v0.16.1
2 parents 759c713 + e1017f3 commit dca640c

24 files changed

Lines changed: 992 additions & 19 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
2-
appVersion: 0.12.4
2+
appVersion: 0.16.1
33
description: HolmesGPT Helm chart for Kubernetes
44
name: holmes
55
type: application
6-
version: 0.12.4
6+
version: 0.16.1

extensions/holmesgpt/config/holmesgpt/charts/holmes/templates/holmes.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ metadata:
66
labels:
77
app: holmes
88
spec:
9-
replicas: 1
9+
{{- if (not .Values.autoscaling.enabled) }}
10+
replicas: {{ .Values.replicas }}
11+
{{- end }}
12+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
1013
selector:
1114
matchLabels:
1215
app: holmes
@@ -17,6 +20,9 @@ spec:
1720
annotations:
1821
# checksum annotation triggering pod reload when .Values.toolsets changes by helm upgrade
1922
checksum/toolset-config: {{ list .Values.toolsets .Values.modelList .Values.mcp_servers | toYaml | sha256sum }}
23+
{{- with .Values.podAnnotations }}
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
2026
spec:
2127
{{- if .Values.customServiceAccountName }}
2228
serviceAccountName: {{ .Values.customServiceAccountName }}

extensions/holmesgpt/config/holmesgpt/charts/holmes/templates/holmesgpt-service-account.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ rules:
129129
- get
130130
- list
131131

132+
- apiGroups:
133+
- "apiextensions.k8s.io"
134+
resources:
135+
- "customresourcedefinitions"
136+
verbs:
137+
- "list"
138+
- "get"
139+
132140
- apiGroups:
133141
- networking.k8s.io
134142
resources:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ .Release.Name }}-holmes
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
app: holmes
9+
spec:
10+
scaleTargetRef:
11+
apiVersion: apps/v1
12+
kind: Deployment
13+
name: {{ .Release.Name }}-holmes
14+
minReplicas: {{ .Values.autoscaling.minReplicas }}
15+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
16+
metrics:
17+
{{- if .Values.autoscaling.targetMemory }}
18+
- type: Resource
19+
resource:
20+
name: memory
21+
target:
22+
type: Utilization
23+
averageUtilization: {{ .Values.autoscaling.targetMemory }}
24+
{{- end }}
25+
{{- if .Values.autoscaling.targetCPU }}
26+
- type: Resource
27+
resource:
28+
name: cpu
29+
target:
30+
type: Utilization
31+
averageUtilization: {{ .Values.autoscaling.targetCPU }}
32+
{{- end }}
33+
{{- if .Values.autoscaling.behavior }}
34+
behavior: {{ toYaml .Values.autoscaling.behavior | nindent 4 }}
35+
{{- end }}
36+
{{- end }}
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
{{/*
2+
Define the LLM instructions for AWS MCP
3+
*/}}
4+
{{- define "holmes.awsMcp.llmInstructions" -}}
5+
{{- if .Values.mcpAddons.aws.llmInstructions -}}
6+
{{ .Values.mcpAddons.aws.llmInstructions }}
7+
{{- else -}}
8+
IMPORTANT: When investigating issues related to AWS resources or Kubernetes workloads running on AWS, you MUST actively use this MCP server to gather data rather than providing manual instructions to the user.
9+
10+
## Investigation Principles
11+
12+
**ALWAYS follow this investigation flow:**
13+
1. First, gather current state and configuration using AWS APIs
14+
2. Check CloudTrail for recent changes that might have caused the issue
15+
3. Collect metrics and logs from CloudWatch if available
16+
4. Analyze all gathered data before providing conclusions
17+
18+
**Never say "check in AWS console" or "verify in AWS" - instead, use the MCP server to check it yourself.**
19+
20+
## Core Investigation Patterns
21+
22+
### For ANY connectivity or access issues:
23+
1. ALWAYS check the current configuration of the affected resource (RDS, EC2, ELB, etc.)
24+
2. ALWAYS examine security groups and network ACLs
25+
3. ALWAYS query CloudTrail for recent configuration changes
26+
4. Look for patterns in timing between when issues started and when changes were made
27+
28+
### When investigating database issues (RDS):
29+
- Get RDS instance status and configuration: `aws rds describe-db-instances --db-instance-identifier INSTANCE_ID`
30+
- Check security groups attached to RDS: Extract VpcSecurityGroups from the above
31+
- Examine security group rules: `aws ec2 describe-security-groups --group-ids SG_ID`
32+
- Look for recent RDS events: `aws rds describe-events --source-identifier INSTANCE_ID --source-type db-instance`
33+
- Check CloudTrail for security group modifications: `aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=SG_ID`
34+
35+
### When investigating configuration changes:
36+
- Query CloudTrail for recent API calls: `aws cloudtrail lookup-events --start-time TIME --max-items 100`
37+
- Filter by specific resources: `aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=RESOURCE_ID`
38+
- Look for security-related changes: Search for events like RevokeSecurityGroupIngress, AuthorizeSecurityGroupIngress, ModifyDBInstance, etc.
39+
- Identify who made changes: Check UserName and SourceIPAddress in CloudTrail events
40+
41+
### When investigating pod/container issues on EKS:
42+
- Check EKS cluster status: `aws eks describe-cluster --name CLUSTER_NAME`
43+
- Examine node groups: `aws eks describe-nodegroup --cluster-name CLUSTER_NAME --nodegroup-name NODEGROUP`
44+
- Search CloudWatch Container Insights logs if available
45+
```bash
46+
aws logs filter-log-events \
47+
--log-group-name /aws/containerinsights/CLUSTER_NAME/application \
48+
--start-time $(date -d '1 hour ago' +%s)000 \
49+
--max-items 500
50+
```
51+
- Check EC2 instances hosting the nodes: `aws ec2 describe-instances --instance-ids INSTANCE_ID`
52+
53+
### For networking issues:
54+
- Describe VPC configuration: `aws ec2 describe-vpcs --vpc-ids VPC_ID`
55+
- Check route tables: `aws ec2 describe-route-tables --filters "Name=vpc-id,Values=VPC_ID"`
56+
- Examine network ACLs: `aws ec2 describe-network-acls --filters "Name=vpc-id,Values=VPC_ID"`
57+
- Review security group rules: `aws ec2 describe-security-groups --group-ids SG_ID`
58+
59+
### For load balancer issues:
60+
- Get load balancer status: `aws elbv2 describe-load-balancers --names LB_NAME`
61+
- Check target health: `aws elbv2 describe-target-health --target-group-arn TG_ARN`
62+
- Review listener rules: `aws elbv2 describe-listeners --load-balancer-arn LB_ARN`
63+
64+
## Key Commands for Root Cause Analysis
65+
66+
### CloudTrail Investigation (ALWAYS use when troubleshooting):
67+
Find all recent changes in the last hour:
68+
```
69+
aws cloudtrail lookup-events --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) --max-items 100
70+
```
71+
72+
Find changes to a specific security group:
73+
```
74+
aws cloudtrail lookup-events --lookup-attributes AttributeKey=ResourceName,AttributeValue=SECURITY_GROUP_ID --max-items 20
75+
```
76+
77+
Find who made changes:
78+
```
79+
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=RevokeSecurityGroupIngress --max-items 20
80+
```
81+
82+
### Resource State Verification:
83+
- Always get the current state before checking what changed
84+
- Compare timestamps of issues with timestamps of changes in CloudTrail
85+
- Look for correlation between configuration changes and issue manifestation
86+
87+
## Important Guidelines:
88+
- If you encounter any AWS resource in the investigation, immediately fetch its details using AWS commands
89+
- Don't assume or guess configurations - retrieve actual data
90+
- When you see connection timeouts or access denied errors, immediately check security groups and CloudTrail
91+
- Always include relevant timestamps when querying for historical data
92+
- If Container Insights is mentioned or available, use it for pod-level investigations
93+
94+
Remember: Your goal is to gather evidence from AWS, not to instruct the user to gather it. Use the MCP server proactively to build a complete picture of what happened.
95+
96+
Some of the available operations include: (there are many other operations, everything included in the aws cli)
97+
- CloudWatch: Query logs, metrics, alarms, and insights
98+
- EC2: Describe instances, security groups, VPCs, networking
99+
- IAM: Check roles, policies, permissions
100+
- RDS: Database metrics, performance insights, configurations
101+
- ECS/EKS: Container and Kubernetes cluster management
102+
- S3: Bucket operations and object management
103+
- Lambda: Function invocations and logs
104+
- Organizations: Billing and cost analysis
105+
106+
Example commands:
107+
- aws logs describe-log-groups
108+
- aws logs filter-log-events --log-group-name <group> --filter-pattern "ERROR"
109+
- aws ec2 describe-instances --instance-ids <id>
110+
- aws iam simulate-principal-policy --policy-source-arn <arn>
111+
- aws rds describe-db-instances
112+
- aws cloudwatch get-metric-statistics
113+
- aws ce get-cost-and-usage
114+
115+
## ⚠️ MEMORY OPTIMIZATION GUIDELINES ⚠️
116+
117+
**The AWS MCP server can experience memory pressure with very large queries. Follow these guidelines to balance data retrieval with stability:**
118+
119+
### Query Limits by Service Type
120+
121+
| Service | Safe Limit | Max Limit | Notes |
122+
|---------|-----------|-----------|--------|
123+
| **CloudWatch Logs** | 500 items | 1000 items | ALWAYS use time constraints (1-hour window max initially) |
124+
| **CloudTrail** | 200 items | 500 items | Heavy JSON payloads, use 2-hour windows initially |
125+
| **EC2 Describe** | 500 items | 1000 items | Use filters when possible |
126+
| **RDS/ELB** | 100 items | 200 items | Usually fewer resources |
127+
| **S3 List** | 1000 items | 5000 items | Metadata only, not object contents |
128+
| **Cost & Usage** | 30 days | 90 days | Use DAILY granularity, not HOURLY |
129+
130+
### Critical Rules
131+
1. **NEVER download S3 object contents** (can be GBs)
132+
2. **ALWAYS use time constraints for logs** (CloudWatch, VPC Flow Logs)
133+
3. **ALWAYS use RECENT time constraints for logs** - Even with --max-items, AWS scans ALL data in the time range!
134+
4. **ALWAYS use small time windows. 1-2 hours. It's ok to do multiple queries.
135+
5. **START with recommended limits**, increase if needed
136+
6. **If query times out**, reduce time window FIRST (not just --max-items)3. **START with recommended limits**, increase if needed
137+
138+
## Investigation Principles
139+
140+
## Memory-Optimized Query Examples
141+
142+
### CloudTrail Investigation (Medium Memory Risk):
143+
```bash
144+
# Good - Reasonable time window with sufficient data
145+
aws cloudtrail lookup-events --start-time $(date -u -d '2 hours ago' +%Y-%m-%dT%H:%M:%S) --max-items 200
146+
147+
# Better - Targeted search for specific events
148+
aws cloudtrail lookup-events \
149+
--lookup-attributes AttributeKey=EventName,AttributeValue=RevokeSecurityGroupIngress \
150+
--start-time $(date -u -d '4 hours ago' +%Y-%m-%dT%H:%M:%S) \
151+
--max-items 100
152+
153+
# If you need more history, paginate
154+
aws cloudtrail lookup-events --start-time $(date -u -d '6 hours ago' +%Y-%m-%dT%H:%M:%S) --max-items 200
155+
# Then use --starting-token if needed for next page
156+
```
157+
158+
### CloudWatch Logs (High Memory Risk):
159+
```bash
160+
# Safe - Time-bounded with reasonable limits
161+
aws logs filter-log-events \
162+
--log-group-name /aws/eks/cluster/cluster \
163+
--start-time $(date -d '1 hour ago' +%s)000 \
164+
--filter-pattern "ERROR" \
165+
--max-items 500
166+
167+
# For debugging specific pods/containers
168+
aws logs filter-log-events \
169+
--log-group-name /aws/containerinsights/CLUSTER/application \
170+
--filter-pattern "{ $.kubernetes.pod_name = \"POD_NAME\" }" \
171+
--start-time $(date -d '2 hours ago' +%s)000 \
172+
--max-items 300
173+
```
174+
175+
### EC2 Operations:
176+
```bash
177+
# Can handle more items for instance metadata
178+
aws ec2 describe-instances --max-results 500
179+
180+
# With filters for large environments
181+
aws ec2 describe-instances \
182+
--filters "Name=tag:Environment,Values=production" \
183+
--max-results 200
184+
```
185+
186+
187+
## Progressive Investigation Strategy
188+
189+
### Start Conservative, Then Expand:
190+
1. **Initial Query**: Use recommended limits (see table above)
191+
2. **If Insufficient**: Double the limit or time window
192+
3. **If Times Out**: Halve the limit and add more filters
193+
4. **For Historical Analysis**: Use pagination with --starting-token
194+
195+
196+
## What NOT to Query:
197+
198+
- ❌ **S3 Object Contents**: Use presigned URLs or tell user to download
199+
- ❌ **CloudWatch Logs without time bounds**: Always specify --start-time
200+
- ❌ **VPC Flow Logs for busy networks**: Use specific filters or sample
201+
- ❌ **Full Config History**: Use --limit and specific resource types
202+
- ❌ **X-Ray Traces in bulk**: Query specific trace IDs
203+
204+
### 🔄 PAGINATION BEST PRACTICES
205+
206+
**Use pagination to prevent OOM while getting comprehensive data:**
207+
208+
#### How to Paginate:
209+
```bash
210+
# Step 1: Initial query with --max-items
211+
aws cloudtrail lookup-events --start-time $(date -u -d '2 hours ago' +%Y-%m-%dT%H:%M:%S) --max-items 100 > page1.json
212+
213+
# Step 2: Check if NextToken exists in output
214+
# If NextToken exists, there's more data available
215+
216+
# Step 3: Get next page using --starting-token
217+
aws cloudtrail lookup-events --start-time $(date -u -d '2 hours ago' +%Y-%m-%dT%H:%M:%S) --max-items 100 --starting-token <NextToken> > page2.json
218+
219+
# Continue until no NextToken is returned
220+
221+
Services Supporting Pagination:
222+
223+
- CloudTrail: Use --max-items and --starting-token
224+
- CloudWatch Logs: Use --max-items and --starting-token
225+
- EC2: Use --max-results and --next-token
226+
- RDS: Use --max-records and --marker
227+
- S3: Use --max-items and --starting-token
228+
- Cost Explorer: Results are paginated by default with NextPageToken
229+
230+
When to Use Pagination:
231+
232+
- Always for CloudTrail when investigating beyond 1 hour
233+
- Always for CloudWatch Logs when searching broad patterns
234+
- For EC2 when describing >200 instances
235+
- For any query that returns a NextToken/Marker
236+
237+
Pagination Strategy:
238+
239+
1. Start with smaller pages (100-200 items)
240+
2. Process each page before fetching next
241+
3. Stop when you find what you need
242+
4. If investigating trends, sample pages instead of fetching all
243+
244+
{{- end -}}
245+
{{- end -}}

0 commit comments

Comments
 (0)