@techwavedev/agi-agent-kit 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @techwavedev/agi-agent-kit might be problematic. Click here for more details.
- package/CHANGELOG.md +82 -1
- package/README.md +190 -12
- package/bin/init.js +30 -2
- package/package.json +6 -3
- package/templates/base/AGENTS.md +54 -23
- package/templates/base/README.md +325 -0
- package/templates/base/directives/memory_integration.md +95 -0
- package/templates/base/execution/memory_manager.py +309 -0
- package/templates/base/execution/session_boot.py +218 -0
- package/templates/base/execution/session_init.py +320 -0
- package/templates/base/skill-creator/SKILL_skillcreator.md +23 -36
- package/templates/base/skill-creator/scripts/init_skill.py +18 -135
- package/templates/skills/ec/README.md +31 -0
- package/templates/skills/ec/aws/SKILL.md +1020 -0
- package/templates/skills/ec/aws/defaults.yaml +13 -0
- package/templates/skills/ec/aws/references/common_patterns.md +80 -0
- package/templates/skills/ec/aws/references/mcp_servers.md +98 -0
- package/templates/skills/ec/aws-terraform/SKILL.md +349 -0
- package/templates/skills/ec/aws-terraform/references/best_practices.md +394 -0
- package/templates/skills/ec/aws-terraform/references/checkov_reference.md +337 -0
- package/templates/skills/ec/aws-terraform/scripts/configure_mcp.py +150 -0
- package/templates/skills/ec/confluent-kafka/SKILL.md +655 -0
- package/templates/skills/ec/confluent-kafka/references/ansible_playbooks.md +792 -0
- package/templates/skills/ec/confluent-kafka/references/ec_deployment.md +579 -0
- package/templates/skills/ec/confluent-kafka/references/kraft_migration.md +490 -0
- package/templates/skills/ec/confluent-kafka/references/troubleshooting.md +778 -0
- package/templates/skills/ec/confluent-kafka/references/upgrade_7x_to_8x.md +488 -0
- package/templates/skills/ec/confluent-kafka/scripts/kafka_health_check.py +435 -0
- package/templates/skills/ec/confluent-kafka/scripts/upgrade_preflight.py +568 -0
- package/templates/skills/ec/confluent-kafka/scripts/validate_config.py +455 -0
- package/templates/skills/ec/consul/SKILL.md +427 -0
- package/templates/skills/ec/consul/references/acl_setup.md +168 -0
- package/templates/skills/ec/consul/references/ha_config.md +196 -0
- package/templates/skills/ec/consul/references/troubleshooting.md +267 -0
- package/templates/skills/ec/consul/references/upgrades.md +213 -0
- package/templates/skills/ec/consul/scripts/consul_health_report.py +530 -0
- package/templates/skills/ec/consul/scripts/consul_status.py +264 -0
- package/templates/skills/ec/consul/scripts/generate_values.py +170 -0
- package/templates/skills/ec/documentation/SKILL.md +351 -0
- package/templates/skills/ec/documentation/references/best_practices.md +201 -0
- package/templates/skills/ec/documentation/scripts/analyze_code.py +307 -0
- package/templates/skills/ec/documentation/scripts/detect_changes.py +460 -0
- package/templates/skills/ec/documentation/scripts/generate_changelog.py +312 -0
- package/templates/skills/ec/documentation/scripts/sync_docs.py +272 -0
- package/templates/skills/ec/documentation/scripts/update_skill_docs.py +366 -0
- package/templates/skills/ec/gitlab/SKILL.md +529 -0
- package/templates/skills/ec/gitlab/references/agent_installation.md +416 -0
- package/templates/skills/ec/gitlab/references/api_reference.md +508 -0
- package/templates/skills/ec/gitlab/references/gitops_flux.md +465 -0
- package/templates/skills/ec/gitlab/references/troubleshooting.md +518 -0
- package/templates/skills/ec/gitlab/scripts/generate_agent_values.py +329 -0
- package/templates/skills/ec/gitlab/scripts/gitlab_agent_status.py +414 -0
- package/templates/skills/ec/jira/SKILL.md +484 -0
- package/templates/skills/ec/jira/references/jql_reference.md +148 -0
- package/templates/skills/ec/jira/scripts/add_comment.py +91 -0
- package/templates/skills/ec/jira/scripts/bulk_log_work.py +124 -0
- package/templates/skills/ec/jira/scripts/create_ticket.py +162 -0
- package/templates/skills/ec/jira/scripts/get_ticket.py +191 -0
- package/templates/skills/ec/jira/scripts/jira_client.py +383 -0
- package/templates/skills/ec/jira/scripts/log_work.py +154 -0
- package/templates/skills/ec/jira/scripts/search_tickets.py +104 -0
- package/templates/skills/ec/jira/scripts/update_comment.py +67 -0
- package/templates/skills/ec/jira/scripts/update_ticket.py +161 -0
- package/templates/skills/ec/karpenter/SKILL.md +301 -0
- package/templates/skills/ec/karpenter/references/ec2nodeclasses.md +421 -0
- package/templates/skills/ec/karpenter/references/migration.md +396 -0
- package/templates/skills/ec/karpenter/references/nodepools.md +400 -0
- package/templates/skills/ec/karpenter/references/troubleshooting.md +359 -0
- package/templates/skills/ec/karpenter/scripts/generate_ec2nodeclass.py +187 -0
- package/templates/skills/ec/karpenter/scripts/generate_nodepool.py +245 -0
- package/templates/skills/ec/karpenter/scripts/karpenter_status.py +359 -0
- package/templates/skills/ec/opensearch/SKILL.md +720 -0
- package/templates/skills/ec/opensearch/references/ml_neural_search.md +576 -0
- package/templates/skills/ec/opensearch/references/operator.md +532 -0
- package/templates/skills/ec/opensearch/references/query_dsl.md +532 -0
- package/templates/skills/ec/opensearch/scripts/configure_mcp.py +148 -0
- package/templates/skills/ec/victoriametrics/SKILL.md +598 -0
- package/templates/skills/ec/victoriametrics/references/kubernetes.md +531 -0
- package/templates/skills/ec/victoriametrics/references/prometheus_migration.md +333 -0
- package/templates/skills/ec/victoriametrics/references/troubleshooting.md +442 -0
- package/templates/skills/knowledge/SKILLS_CATALOG.md +274 -4
- package/templates/skills/knowledge/intelligent-routing/SKILL.md +237 -164
- package/templates/skills/knowledge/parallel-agents/SKILL.md +345 -73
- package/templates/skills/knowledge/plugin-discovery/SKILL.md +582 -0
- package/templates/skills/knowledge/plugin-discovery/scripts/platform_setup.py +1083 -0
- package/templates/skills/knowledge/design-md/README.md +0 -34
- package/templates/skills/knowledge/design-md/SKILL.md +0 -193
- package/templates/skills/knowledge/design-md/examples/DESIGN.md +0 -154
- package/templates/skills/knowledge/notebooklm-mcp/SKILL.md +0 -71
- package/templates/skills/knowledge/notebooklm-mcp/assets/example_asset.txt +0 -24
- package/templates/skills/knowledge/notebooklm-mcp/references/api_reference.md +0 -34
- package/templates/skills/knowledge/notebooklm-mcp/scripts/example.py +0 -19
- package/templates/skills/knowledge/react-components/README.md +0 -36
- package/templates/skills/knowledge/react-components/SKILL.md +0 -53
- package/templates/skills/knowledge/react-components/examples/gold-standard-card.tsx +0 -80
- package/templates/skills/knowledge/react-components/package-lock.json +0 -231
- package/templates/skills/knowledge/react-components/package.json +0 -16
- package/templates/skills/knowledge/react-components/resources/architecture-checklist.md +0 -15
- package/templates/skills/knowledge/react-components/resources/component-template.tsx +0 -37
- package/templates/skills/knowledge/react-components/resources/stitch-api-reference.md +0 -14
- package/templates/skills/knowledge/react-components/resources/style-guide.json +0 -27
- package/templates/skills/knowledge/react-components/scripts/fetch-stitch.sh +0 -30
- package/templates/skills/knowledge/react-components/scripts/validate.js +0 -68
- package/templates/skills/knowledge/self-update/SKILL.md +0 -60
- package/templates/skills/knowledge/self-update/scripts/update_kit.py +0 -103
- package/templates/skills/knowledge/stitch-loop/README.md +0 -54
- package/templates/skills/knowledge/stitch-loop/SKILL.md +0 -235
- package/templates/skills/knowledge/stitch-loop/examples/SITE.md +0 -73
- package/templates/skills/knowledge/stitch-loop/examples/next-prompt.md +0 -25
- package/templates/skills/knowledge/stitch-loop/resources/baton-schema.md +0 -61
- package/templates/skills/knowledge/stitch-loop/resources/site-template.md +0 -104
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: consul
|
|
3
|
+
description: HashiCorp Consul specialist for EKS clusters. Use for Consul service mesh installation, configuration, HA setup, maintenance, updates, upgrades, troubleshooting, and optimization. Covers Consul Connect, intentions, health checks, ACLs, gossip encryption, TLS configuration, federation, and Kubernetes integration via consul-k8s Helm chart. Requires kubectl and helm access to target EKS cluster.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Consul Skill
|
|
7
|
+
|
|
8
|
+
Comprehensive skill for managing HashiCorp Consul—the service mesh and service discovery solution—on Amazon EKS.
|
|
9
|
+
|
|
10
|
+
> **Last Updated:** 2026-01-20 from [consul.io](https://developer.hashicorp.com/consul)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Set cluster context
|
|
18
|
+
export CLUSTER_NAME=eks-nonprod
|
|
19
|
+
aws eks update-kubeconfig --name $CLUSTER_NAME --region eu-west-1
|
|
20
|
+
|
|
21
|
+
# Verify Consul is running
|
|
22
|
+
kubectl get pods -n consul
|
|
23
|
+
helm list -n consul
|
|
24
|
+
|
|
25
|
+
# Check Consul cluster status
|
|
26
|
+
kubectl exec -n consul consul-server-0 -- consul members
|
|
27
|
+
kubectl exec -n consul consul-server-0 -- consul operator raft list-peers
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Core Concepts
|
|
33
|
+
|
|
34
|
+
### Key Components
|
|
35
|
+
|
|
36
|
+
| Component | Description |
|
|
37
|
+
| ------------------- | ------------------------------------------------------------- |
|
|
38
|
+
| **Consul Server** | Maintains cluster state, handles queries, replicates data |
|
|
39
|
+
| **Consul Client** | Runs on each node, registers services, performs health checks |
|
|
40
|
+
| **Connect Sidecar** | Envoy proxy for mTLS and service mesh traffic |
|
|
41
|
+
| **Mesh Gateway** | Routes traffic between datacenters/clusters |
|
|
42
|
+
| **Ingress Gateway** | External traffic entry point |
|
|
43
|
+
|
|
44
|
+
### Architecture on EKS
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
┌─────────────────────────────────────────────────┐
|
|
48
|
+
│ EKS Cluster │
|
|
49
|
+
│ ┌─────────────────────────────────────────────┐│
|
|
50
|
+
│ │ consul namespace ││
|
|
51
|
+
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ││
|
|
52
|
+
│ │ │Server 0 │ │Server 1 │ │Server 2 │ (HA) ││
|
|
53
|
+
│ │ └─────────┘ └─────────┘ └─────────┘ ││
|
|
54
|
+
│ │ ┌──────────────┐ ┌──────────────┐ ││
|
|
55
|
+
│ │ │Mesh Gateway │ │Ingress GW │ ││
|
|
56
|
+
│ │ └──────────────┘ └──────────────┘ ││
|
|
57
|
+
│ └─────────────────────────────────────────────┘│
|
|
58
|
+
│ ┌─────────────────────────────────────────────┐│
|
|
59
|
+
│ │ Application namespaces ││
|
|
60
|
+
│ │ Pod + Envoy Sidecar (auto-injected) ││
|
|
61
|
+
│ └─────────────────────────────────────────────┘│
|
|
62
|
+
└─────────────────────────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Common Workflows
|
|
68
|
+
|
|
69
|
+
### 1. Check Consul Health
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Server status
|
|
73
|
+
kubectl exec -n consul consul-server-0 -- consul members
|
|
74
|
+
|
|
75
|
+
# Raft consensus (HA health)
|
|
76
|
+
kubectl exec -n consul consul-server-0 -- consul operator raft list-peers
|
|
77
|
+
|
|
78
|
+
# Server logs
|
|
79
|
+
kubectl logs -n consul -l app=consul,component=server --tail=100
|
|
80
|
+
|
|
81
|
+
# Connect CA status
|
|
82
|
+
kubectl exec -n consul consul-server-0 -- consul connect ca get-config
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Install Consul on EKS (HA)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Add Helm repo
|
|
89
|
+
helm repo add hashicorp https://helm.releases.hashicorp.com
|
|
90
|
+
helm repo update
|
|
91
|
+
|
|
92
|
+
# Create namespace
|
|
93
|
+
kubectl create namespace consul
|
|
94
|
+
|
|
95
|
+
# Install with HA configuration
|
|
96
|
+
helm install consul hashicorp/consul \
|
|
97
|
+
--namespace consul \
|
|
98
|
+
--values consul-values.yaml \
|
|
99
|
+
--version 1.3.0
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Minimal HA values (`consul-values.yaml`):**
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
global:
|
|
106
|
+
name: consul
|
|
107
|
+
datacenter: dc1
|
|
108
|
+
gossipEncryption:
|
|
109
|
+
autoGenerate: true
|
|
110
|
+
tls:
|
|
111
|
+
enabled: true
|
|
112
|
+
enableAutoEncrypt: true
|
|
113
|
+
acls:
|
|
114
|
+
manageSystemACLs: true
|
|
115
|
+
|
|
116
|
+
server:
|
|
117
|
+
replicas: 3
|
|
118
|
+
resources:
|
|
119
|
+
requests:
|
|
120
|
+
memory: "200Mi"
|
|
121
|
+
cpu: "100m"
|
|
122
|
+
limits:
|
|
123
|
+
memory: "500Mi"
|
|
124
|
+
cpu: "500m"
|
|
125
|
+
storageClass: gp3
|
|
126
|
+
storage: 10Gi
|
|
127
|
+
affinity: |
|
|
128
|
+
podAntiAffinity:
|
|
129
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
130
|
+
- labelSelector:
|
|
131
|
+
matchLabels:
|
|
132
|
+
app: consul
|
|
133
|
+
component: server
|
|
134
|
+
topologyKey: kubernetes.io/hostname
|
|
135
|
+
|
|
136
|
+
connectInject:
|
|
137
|
+
enabled: true
|
|
138
|
+
default: false
|
|
139
|
+
|
|
140
|
+
controller:
|
|
141
|
+
enabled: true
|
|
142
|
+
|
|
143
|
+
meshGateway:
|
|
144
|
+
enabled: false
|
|
145
|
+
|
|
146
|
+
ingressGateway:
|
|
147
|
+
enabled: false
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 3. Upgrade Consul
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Check current version
|
|
154
|
+
helm list -n consul
|
|
155
|
+
|
|
156
|
+
# Review release notes first!
|
|
157
|
+
# https://developer.hashicorp.com/consul/docs/release-notes
|
|
158
|
+
|
|
159
|
+
# Dry-run upgrade
|
|
160
|
+
helm upgrade consul hashicorp/consul \
|
|
161
|
+
--namespace consul \
|
|
162
|
+
--values consul-values.yaml \
|
|
163
|
+
--version <NEW_VERSION> \
|
|
164
|
+
--dry-run
|
|
165
|
+
|
|
166
|
+
# Perform upgrade
|
|
167
|
+
helm upgrade consul hashicorp/consul \
|
|
168
|
+
--namespace consul \
|
|
169
|
+
--values consul-values.yaml \
|
|
170
|
+
--version <NEW_VERSION>
|
|
171
|
+
|
|
172
|
+
# Watch rollout
|
|
173
|
+
kubectl rollout status statefulset/consul-server -n consul
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 4. Configure Service Intentions
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
# allow-api-to-db.yaml
|
|
180
|
+
apiVersion: consul.hashicorp.com/v1alpha1
|
|
181
|
+
kind: ServiceIntentions
|
|
182
|
+
metadata:
|
|
183
|
+
name: api-to-database
|
|
184
|
+
namespace: consul
|
|
185
|
+
spec:
|
|
186
|
+
destination:
|
|
187
|
+
name: database
|
|
188
|
+
sources:
|
|
189
|
+
- name: api
|
|
190
|
+
action: allow
|
|
191
|
+
- name: "*"
|
|
192
|
+
action: deny
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
kubectl apply -f allow-api-to-db.yaml
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 5. Enable Connect Sidecar Injection
|
|
200
|
+
|
|
201
|
+
Add annotation to deployments:
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
annotations:
|
|
205
|
+
consul.hashicorp.com/connect-inject: "true"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Or enable namespace-wide:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
kubectl label namespace myapp consul.hashicorp.com/connect-inject=true
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Troubleshooting Guide
|
|
217
|
+
|
|
218
|
+
### Common Issues
|
|
219
|
+
|
|
220
|
+
| Issue | Diagnosis | Solution |
|
|
221
|
+
| ------------------------------- | ----------------------------------- | --------------------------------------------- |
|
|
222
|
+
| **Servers not forming cluster** | `consul members` shows < 3 | Check gossip encryption key, network policies |
|
|
223
|
+
| **Sidecar not injecting** | Pods missing envoy container | Verify webhook, check labels/annotations |
|
|
224
|
+
| **ACL denied** | `permission denied` errors | Bootstrap ACLs, create proper tokens |
|
|
225
|
+
| **TLS handshake failures** | Connection refused between services | Verify CA, check certificate rotation |
|
|
226
|
+
| **High latency** | Services slow to respond | Check Envoy resource limits, xDS updates |
|
|
227
|
+
|
|
228
|
+
### Debug Commands
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Check sidecar injection webhook
|
|
232
|
+
kubectl get mutatingwebhookconfigurations | grep consul
|
|
233
|
+
|
|
234
|
+
# View injector logs
|
|
235
|
+
kubectl logs -n consul -l app=consul,component=connect-injector
|
|
236
|
+
|
|
237
|
+
# Check service registration
|
|
238
|
+
kubectl exec -n consul consul-server-0 -- consul catalog services
|
|
239
|
+
|
|
240
|
+
# Debug Envoy proxy
|
|
241
|
+
kubectl exec -n <namespace> <pod> -c consul-dataplane -- wget -qO- localhost:19000/config_dump
|
|
242
|
+
|
|
243
|
+
# Check intentions
|
|
244
|
+
kubectl get serviceintentions -A
|
|
245
|
+
|
|
246
|
+
# ACL token details
|
|
247
|
+
kubectl exec -n consul consul-server-0 -- consul acl token list
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Reference Files
|
|
251
|
+
|
|
252
|
+
- **[references/ha_config.md](references/ha_config.md)** — HA configuration patterns
|
|
253
|
+
- **[references/acl_setup.md](references/acl_setup.md)** — ACL bootstrap and token management
|
|
254
|
+
- **[references/troubleshooting.md](references/troubleshooting.md)** — Detailed troubleshooting scenarios
|
|
255
|
+
- **[references/upgrades.md](references/upgrades.md)** — Version upgrade paths and breaking changes
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## High Availability (HA)
|
|
260
|
+
|
|
261
|
+
### Requirements
|
|
262
|
+
|
|
263
|
+
- **Minimum 3 servers** for quorum (tolerates 1 failure)
|
|
264
|
+
- **5 servers** for higher availability (tolerates 2 failures)
|
|
265
|
+
- **Anti-affinity** to spread across nodes/AZs
|
|
266
|
+
|
|
267
|
+
### HA Configuration
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
server:
|
|
271
|
+
replicas: 3
|
|
272
|
+
affinity: |
|
|
273
|
+
podAntiAffinity:
|
|
274
|
+
requiredDuringSchedulingIgnoredDuringExecution:
|
|
275
|
+
- labelSelector:
|
|
276
|
+
matchLabels:
|
|
277
|
+
app: consul
|
|
278
|
+
component: server
|
|
279
|
+
topologyKey: topology.kubernetes.io/zone
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Quorum Loss Recovery
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# Check peer status
|
|
286
|
+
kubectl exec -n consul consul-server-0 -- consul operator raft list-peers
|
|
287
|
+
|
|
288
|
+
# If quorum lost and need to recover with single node:
|
|
289
|
+
kubectl exec -n consul consul-server-0 -- consul operator raft remove-peer -address=<failed-peer>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Maintenance Tasks
|
|
295
|
+
|
|
296
|
+
### Backup and Restore
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# Snapshot (backup)
|
|
300
|
+
kubectl exec -n consul consul-server-0 -- consul snapshot save /tmp/backup.snap
|
|
301
|
+
kubectl cp consul/consul-server-0:/tmp/backup.snap ./consul-backup-$(date +%Y%m%d).snap
|
|
302
|
+
|
|
303
|
+
# Restore
|
|
304
|
+
kubectl cp ./backup.snap consul/consul-server-0:/tmp/restore.snap
|
|
305
|
+
kubectl exec -n consul consul-server-0 -- consul snapshot restore /tmp/restore.snap
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Certificate Rotation
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Check certificate expiry
|
|
312
|
+
kubectl exec -n consul consul-server-0 -- consul connect ca get-config
|
|
313
|
+
|
|
314
|
+
# Force CA rotation (with new root)
|
|
315
|
+
kubectl exec -n consul consul-server-0 -- consul connect ca set-config -config-file=/tmp/ca-config.json
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Gossip Key Rotation
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Generate new key
|
|
322
|
+
consul keygen
|
|
323
|
+
|
|
324
|
+
# Install new key (phase 1: add to all nodes)
|
|
325
|
+
kubectl exec -n consul consul-server-0 -- consul keyring -install <new-key>
|
|
326
|
+
|
|
327
|
+
# Make primary (phase 2)
|
|
328
|
+
kubectl exec -n consul consul-server-0 -- consul keyring -use <new-key>
|
|
329
|
+
|
|
330
|
+
# Remove old key (phase 3)
|
|
331
|
+
kubectl exec -n consul consul-server-0 -- consul keyring -remove <old-key>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Scripts
|
|
337
|
+
|
|
338
|
+
### Generate Health Report
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# Generate PDF + Markdown health report for nonprod
|
|
342
|
+
python skills/consul/scripts/consul_health_report.py \
|
|
343
|
+
--environment nonprod \
|
|
344
|
+
--output reports/consul/nonprod/health/
|
|
345
|
+
|
|
346
|
+
# Generate only PDF for prod
|
|
347
|
+
python skills/consul/scripts/consul_health_report.py \
|
|
348
|
+
--environment prod \
|
|
349
|
+
--output reports/consul/prod/health/ \
|
|
350
|
+
--format pdf
|
|
351
|
+
|
|
352
|
+
# Generate markdown only
|
|
353
|
+
python skills/consul/scripts/consul_health_report.py \
|
|
354
|
+
--environment nonprod \
|
|
355
|
+
--format markdown
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Arguments:**
|
|
359
|
+
|
|
360
|
+
- `--environment, -e` — Environment name (nonprod, prod) **required**
|
|
361
|
+
- `--output, -o` — Output directory (default: current)
|
|
362
|
+
- `--format, -f` — Output format: pdf, markdown, or both (default: both)
|
|
363
|
+
- `--namespace, -n` — Consul namespace (default: consul)
|
|
364
|
+
- `--region, -r` — AWS region (default: eu-west-1)
|
|
365
|
+
|
|
366
|
+
**Outputs:**
|
|
367
|
+
|
|
368
|
+
- `consul_health_<env>_<timestamp>.pdf` — Styled PDF report
|
|
369
|
+
- `consul_health_<env>_<timestamp>.md` — Markdown report
|
|
370
|
+
- `consul_health_<env>_<timestamp>.json` — Raw health data
|
|
371
|
+
|
|
372
|
+
### Get Consul Status
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# Run from skill directory
|
|
376
|
+
python scripts/consul_status.py --namespace consul
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Generate Helm Values
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
python scripts/generate_values.py \
|
|
383
|
+
--datacenter dc1 \
|
|
384
|
+
--replicas 3 \
|
|
385
|
+
--connect-inject \
|
|
386
|
+
--acls \
|
|
387
|
+
--tls
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Best Practices
|
|
393
|
+
|
|
394
|
+
### Security
|
|
395
|
+
|
|
396
|
+
1. **Enable ACLs** — Always use `manageSystemACLs: true`
|
|
397
|
+
2. **Enable TLS** — Use `tls.enabled: true`
|
|
398
|
+
3. **Gossip encryption** — Use `gossipEncryption.autoGenerate: true`
|
|
399
|
+
4. **Network policies** — Restrict traffic to Consul ports
|
|
400
|
+
|
|
401
|
+
### Performance
|
|
402
|
+
|
|
403
|
+
1. **Resource limits** — Set appropriate CPU/memory for servers
|
|
404
|
+
2. **Storage class** — Use fast SSD storage (gp3)
|
|
405
|
+
3. **Anti-affinity** — Spread servers across AZs
|
|
406
|
+
|
|
407
|
+
### Reliability
|
|
408
|
+
|
|
409
|
+
1. **3+ servers** — Never run fewer than 3 for production
|
|
410
|
+
2. **Regular backups** — Schedule snapshot backups
|
|
411
|
+
3. **Monitoring** — Export metrics to Prometheus
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Related Skills
|
|
416
|
+
|
|
417
|
+
- **[karpenter](../karpenter/SKILL.md)** — Node autoscaling for Consul workloads
|
|
418
|
+
- **[aws](../aws/SKILL.md)** — Parent AWS skill for broader AWS operations
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## External Resources
|
|
423
|
+
|
|
424
|
+
- [Consul Documentation](https://developer.hashicorp.com/consul/docs)
|
|
425
|
+
- [Consul on Kubernetes](https://developer.hashicorp.com/consul/docs/k8s)
|
|
426
|
+
- [consul-k8s Helm Chart](https://github.com/hashicorp/consul-k8s)
|
|
427
|
+
- [Consul Connect (Service Mesh)](https://developer.hashicorp.com/consul/docs/connect)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Consul ACL Setup and Token Management
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Bootstrap ACLs](#bootstrap-acls)
|
|
6
|
+
- [Token Types](#token-types)
|
|
7
|
+
- [Creating Tokens](#creating-tokens)
|
|
8
|
+
- [Policy Examples](#policy-examples)
|
|
9
|
+
- [Troubleshooting ACLs](#troubleshooting-acls)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Bootstrap ACLs
|
|
14
|
+
|
|
15
|
+
### Automatic Bootstrap (Recommended)
|
|
16
|
+
|
|
17
|
+
When using `manageSystemACLs: true` in Helm values, Consul automatically:
|
|
18
|
+
|
|
19
|
+
- Creates bootstrap token
|
|
20
|
+
- Stores it in Kubernetes secret
|
|
21
|
+
- Creates system tokens for components
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Retrieve bootstrap token
|
|
25
|
+
kubectl get secret consul-bootstrap-acl-token -n consul -o jsonpath='{.data.token}' | base64 -d
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Manual Bootstrap
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Bootstrap ACL system
|
|
32
|
+
kubectl exec -n consul consul-server-0 -- consul acl bootstrap
|
|
33
|
+
|
|
34
|
+
# Save the SecretID (bootstrap token) securely!
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Token Types
|
|
40
|
+
|
|
41
|
+
| Token Type | Purpose | Scope |
|
|
42
|
+
| ---------------- | -------------------------------- | ----------------------- |
|
|
43
|
+
| **Bootstrap** | Initial admin token | Global, all permissions |
|
|
44
|
+
| **Agent** | Node-level operations | Per-node |
|
|
45
|
+
| **Service** | Service registration/intentions | Per-service |
|
|
46
|
+
| **Mesh Gateway** | Cross-datacenter traffic | Federation |
|
|
47
|
+
| **Connect CA** | Certificate authority operations | Connect |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Creating Tokens
|
|
52
|
+
|
|
53
|
+
### Create Policy First
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Create policy file
|
|
57
|
+
cat <<EOF > read-only-policy.hcl
|
|
58
|
+
service_prefix "" {
|
|
59
|
+
policy = "read"
|
|
60
|
+
}
|
|
61
|
+
node_prefix "" {
|
|
62
|
+
policy = "read"
|
|
63
|
+
}
|
|
64
|
+
EOF
|
|
65
|
+
|
|
66
|
+
# Apply policy
|
|
67
|
+
kubectl exec -n consul consul-server-0 -- consul acl policy create \
|
|
68
|
+
-name "read-only" \
|
|
69
|
+
-rules @/tmp/read-only-policy.hcl \
|
|
70
|
+
-token=<bootstrap-token>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Create Token with Policy
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
kubectl exec -n consul consul-server-0 -- consul acl token create \
|
|
77
|
+
-description "Read-only monitoring token" \
|
|
78
|
+
-policy-name "read-only" \
|
|
79
|
+
-token=<bootstrap-token>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Policy Examples
|
|
85
|
+
|
|
86
|
+
### Service Registration Policy
|
|
87
|
+
|
|
88
|
+
```hcl
|
|
89
|
+
service "api" {
|
|
90
|
+
policy = "write"
|
|
91
|
+
}
|
|
92
|
+
service_prefix "" {
|
|
93
|
+
policy = "read"
|
|
94
|
+
}
|
|
95
|
+
node_prefix "" {
|
|
96
|
+
policy = "read"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Mesh Gateway Policy
|
|
101
|
+
|
|
102
|
+
```hcl
|
|
103
|
+
service "mesh-gateway" {
|
|
104
|
+
policy = "write"
|
|
105
|
+
}
|
|
106
|
+
service_prefix "" {
|
|
107
|
+
policy = "read"
|
|
108
|
+
}
|
|
109
|
+
node_prefix "" {
|
|
110
|
+
policy = "read"
|
|
111
|
+
}
|
|
112
|
+
agent_prefix "" {
|
|
113
|
+
policy = "read"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### DNS Query Policy
|
|
118
|
+
|
|
119
|
+
```hcl
|
|
120
|
+
service_prefix "" {
|
|
121
|
+
policy = "read"
|
|
122
|
+
}
|
|
123
|
+
node_prefix "" {
|
|
124
|
+
policy = "read"
|
|
125
|
+
}
|
|
126
|
+
query_prefix "" {
|
|
127
|
+
policy = "read"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Troubleshooting ACLs
|
|
134
|
+
|
|
135
|
+
### Common Errors
|
|
136
|
+
|
|
137
|
+
| Error | Cause | Solution |
|
|
138
|
+
| ------------------- | ---------------------- | ------------------------------------ |
|
|
139
|
+
| `ACL not found` | Token doesn't exist | Create token or use correct SecretID |
|
|
140
|
+
| `Permission denied` | Token lacks permission | Add required policy to token |
|
|
141
|
+
| `ACL disabled` | ACLs not enabled | Enable ACLs in Helm values |
|
|
142
|
+
|
|
143
|
+
### Debug Commands
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# List all tokens
|
|
147
|
+
kubectl exec -n consul consul-server-0 -- consul acl token list -token=<bootstrap>
|
|
148
|
+
|
|
149
|
+
# Read specific token
|
|
150
|
+
kubectl exec -n consul consul-server-0 -- consul acl token read -id <accessor-id> -token=<bootstrap>
|
|
151
|
+
|
|
152
|
+
# List policies
|
|
153
|
+
kubectl exec -n consul consul-server-0 -- consul acl policy list -token=<bootstrap>
|
|
154
|
+
|
|
155
|
+
# Translate legacy tokens (if upgrading)
|
|
156
|
+
kubectl exec -n consul consul-server-0 -- consul acl token update -id <token-id> -upgrade-legacy -token=<bootstrap>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Reset ACLs (Emergency)
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Delete ACL data and re-bootstrap (DATA LOSS!)
|
|
163
|
+
kubectl exec -n consul consul-server-0 -- consul acl bootstrap -reset
|
|
164
|
+
|
|
165
|
+
# Or recreate the bootstrap secret
|
|
166
|
+
kubectl delete secret consul-bootstrap-acl-token -n consul
|
|
167
|
+
helm upgrade consul hashicorp/consul -n consul -f values.yaml
|
|
168
|
+
```
|