@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,529 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitlab
|
|
3
|
+
description: GitLab specialist for Kubernetes agent management on EKS clusters. Use for GitLab agent (agentk) installation, configuration, upgrades, GitOps with Flux, CI/CD pipeline integration, project management via API, token management, and troubleshooting connectivity issues. Covers agent registration, Helm deployments, KAS configuration (self-managed on-prem), impersonation, and multi-cluster setups. Requires kubectl/helm access to target EKS cluster and GitLab API token.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GitLab Skill
|
|
7
|
+
|
|
8
|
+
Comprehensive skill for managing GitLab Kubernetes agents and project integrations on Amazon EKS. This skill covers the full lifecycle of GitLab agent deployment, GitOps workflows with Flux, CI/CD pipeline configurations, and project management via the GitLab API.
|
|
9
|
+
|
|
10
|
+
> **Last Updated:** 2026-01-21 from [docs.gitlab.com](https://docs.gitlab.com/user/clusters/agent/)
|
|
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 GitLab agent is running
|
|
22
|
+
kubectl get pods -n gitlab-agent
|
|
23
|
+
helm list -n gitlab-agent
|
|
24
|
+
|
|
25
|
+
# Check agent logs
|
|
26
|
+
kubectl logs -f -l=app.kubernetes.io/name=gitlab-agent -n gitlab-agent
|
|
27
|
+
|
|
28
|
+
# List agents via API
|
|
29
|
+
curl --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
30
|
+
"https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Core Concepts
|
|
36
|
+
|
|
37
|
+
### Architecture Overview
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ GitLab Self-Managed (On-Prem) │
|
|
42
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
43
|
+
│ │ GitLab Rails + KAS (Kubernetes Agent Server) │ │
|
|
44
|
+
│ │ - Handles agent connections via WebSocket/gRPC │ │
|
|
45
|
+
│ │ - Manages agent tokens and configuration │ │
|
|
46
|
+
│ │ - Proxies kubectl requests from CI/CD │ │
|
|
47
|
+
│ └──────────────────────────────────────────────────────┘ │
|
|
48
|
+
└────────────────────────────────────────────────────────────┘
|
|
49
|
+
│
|
|
50
|
+
WebSocket (wss://)
|
|
51
|
+
│
|
|
52
|
+
┌────────────────────────────────────────────────────────────┐
|
|
53
|
+
│ EKS Cluster │
|
|
54
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
55
|
+
│ │ gitlab-agent namespace │ │
|
|
56
|
+
│ │ ┌─────────────────────────────────────────────┐ │ │
|
|
57
|
+
│ │ │ agentk (GitLab Agent for Kubernetes) │ │ │
|
|
58
|
+
│ │ │ - Connects outbound to KAS │ │ │
|
|
59
|
+
│ │ │ - Watches for configuration changes │ │ │
|
|
60
|
+
│ │ │ - Enables GitOps via Flux │ │ │
|
|
61
|
+
│ │ │ - Proxies K8s API for CI/CD jobs │ │ │
|
|
62
|
+
│ │ └─────────────────────────────────────────────┘ │ │
|
|
63
|
+
│ └──────────────────────────────────────────────────────┘ │
|
|
64
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
65
|
+
│ │ flux-system namespace (GitOps) │ │
|
|
66
|
+
│ │ - Flux controllers for continuous deployment │ │
|
|
67
|
+
│ │ - Watches Git repositories for manifest changes │ │
|
|
68
|
+
│ └──────────────────────────────────────────────────────┘ │
|
|
69
|
+
│ ┌──────────────────────────────────────────────────────┐ │
|
|
70
|
+
│ │ Application namespaces │ │
|
|
71
|
+
│ │ - Deployed workloads managed by GitOps/CI-CD │ │
|
|
72
|
+
│ └──────────────────────────────────────────────────────┘ │
|
|
73
|
+
└────────────────────────────────────────────────────────────┘
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Key Components
|
|
77
|
+
|
|
78
|
+
| Component | Description |
|
|
79
|
+
| --------------- | --------------------------------------------------------------------- |
|
|
80
|
+
| **agentk** | Agent running in cluster, connects outbound to KAS via WebSocket |
|
|
81
|
+
| **KAS** | Kubernetes Agent Server, runs on GitLab instance, manages connections |
|
|
82
|
+
| **Flux** | GitLab-recommended GitOps solution for continuous deployment |
|
|
83
|
+
| **Agent Token** | Authentication token for agent-KAS communication (max 2 active) |
|
|
84
|
+
| **Config File** | `.gitlab/agents/<agent-name>/config.yaml` in the config project |
|
|
85
|
+
|
|
86
|
+
### Deployment Workflows
|
|
87
|
+
|
|
88
|
+
GitLab supports two primary Kubernetes deployment workflows:
|
|
89
|
+
|
|
90
|
+
| Workflow | Description | Recommendation |
|
|
91
|
+
| ------------------- | --------------------------------------------------------- | ------------------ |
|
|
92
|
+
| **GitOps (Flux)** | Flux watches Git repos, auto-deploys on changes | ✅ **Recommended** |
|
|
93
|
+
| **CI/CD (kubectl)** | Pipeline jobs run kubectl against cluster via agent proxy | ⚠️ For migrations |
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Common Workflows
|
|
98
|
+
|
|
99
|
+
### 1. Install Agent on EKS
|
|
100
|
+
|
|
101
|
+
**Step 1: Register Agent in GitLab**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Via API
|
|
105
|
+
curl --request POST \
|
|
106
|
+
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
107
|
+
--header "Content-Type: application/json" \
|
|
108
|
+
--url "https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents" \
|
|
109
|
+
--data '{"name":"eks-nonprod-agent"}'
|
|
110
|
+
|
|
111
|
+
# Save the agent ID from response for token creation
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Or use the GitLab UI: Project → Operate → Kubernetes clusters → Connect a cluster.
|
|
115
|
+
|
|
116
|
+
**Step 2: Create Agent Token**
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
curl --request POST \
|
|
120
|
+
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
121
|
+
--header "Content-Type: application/json" \
|
|
122
|
+
--url "https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents/${AGENT_ID}/tokens" \
|
|
123
|
+
--data '{"name":"initial-token","description":"EKS nonprod agent token"}'
|
|
124
|
+
|
|
125
|
+
# IMPORTANT: Save the token from response - it cannot be retrieved again!
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Step 3: Create Agent Configuration**
|
|
129
|
+
|
|
130
|
+
In your GitLab project, create `.gitlab/agents/eks-nonprod-agent/config.yaml`:
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
# Agent configuration for CI/CD access
|
|
134
|
+
ci_access:
|
|
135
|
+
projects:
|
|
136
|
+
- id: path/to/your/project
|
|
137
|
+
groups:
|
|
138
|
+
- id: path/to/your/group
|
|
139
|
+
|
|
140
|
+
# Enable GitOps with Flux (recommended)
|
|
141
|
+
flux:
|
|
142
|
+
resource_inclusions:
|
|
143
|
+
- api_groups:
|
|
144
|
+
- "*"
|
|
145
|
+
resources:
|
|
146
|
+
- "*"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Step 4: Install with Helm**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Add GitLab Helm repo
|
|
153
|
+
helm repo add gitlab https://charts.gitlab.io
|
|
154
|
+
helm repo update
|
|
155
|
+
|
|
156
|
+
# Install agent (for self-managed GitLab with custom CA)
|
|
157
|
+
helm upgrade --install gitlab-agent gitlab/gitlab-agent \
|
|
158
|
+
--namespace gitlab-agent \
|
|
159
|
+
--create-namespace \
|
|
160
|
+
--set config.token="${AGENT_TOKEN}" \
|
|
161
|
+
--set config.kasAddress="wss://${GITLAB_HOST}/-/kubernetes-agent/" \
|
|
162
|
+
--set-file config.kasCaCert=./gitlab-ca.pem \
|
|
163
|
+
--set image.tag=v17.6.0
|
|
164
|
+
|
|
165
|
+
# Verify installation
|
|
166
|
+
kubectl get pods -n gitlab-agent
|
|
167
|
+
kubectl logs -f -l=app.kubernetes.io/name=gitlab-agent -n gitlab-agent
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 2. Upgrade Agent Version
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Check current version
|
|
174
|
+
helm list -n gitlab-agent
|
|
175
|
+
kubectl get deployment -n gitlab-agent -o jsonpath='{.items[*].spec.template.spec.containers[*].image}'
|
|
176
|
+
|
|
177
|
+
# Get current values (don't use --reuse-values)
|
|
178
|
+
helm get values gitlab-agent -n gitlab-agent > agent-values.yaml
|
|
179
|
+
|
|
180
|
+
# Review GitLab release notes for breaking changes
|
|
181
|
+
# https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/releases
|
|
182
|
+
|
|
183
|
+
# Upgrade to specific version
|
|
184
|
+
helm repo update
|
|
185
|
+
helm upgrade gitlab-agent gitlab/gitlab-agent \
|
|
186
|
+
--namespace gitlab-agent \
|
|
187
|
+
-f agent-values.yaml \
|
|
188
|
+
--set image.tag=v17.8.0
|
|
189
|
+
|
|
190
|
+
# Watch rollout
|
|
191
|
+
kubectl rollout status deployment/gitlab-agent -n gitlab-agent
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Version Compatibility**: Agent version should match GitLab major.minor version. Previous and next minor versions are also supported.
|
|
195
|
+
|
|
196
|
+
### 3. Configure CI/CD Pipeline Access
|
|
197
|
+
|
|
198
|
+
Edit your `.gitlab-ci.yml`:
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
deploy:
|
|
202
|
+
image: bitnami/kubectl:latest
|
|
203
|
+
script:
|
|
204
|
+
# Use the agent's kubecontext
|
|
205
|
+
- kubectl config get-contexts
|
|
206
|
+
- kubectl config use-context path/to/project:eks-nonprod-agent
|
|
207
|
+
- kubectl get pods -n production
|
|
208
|
+
- kubectl apply -f manifests/
|
|
209
|
+
environment:
|
|
210
|
+
name: production
|
|
211
|
+
kubernetes:
|
|
212
|
+
agent: path/to/project:eks-nonprod-agent
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 4. Set Up GitOps with Flux
|
|
216
|
+
|
|
217
|
+
GitLab recommends Flux for GitOps deployments.
|
|
218
|
+
|
|
219
|
+
**Step 1: Bootstrap Flux**
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# Install Flux CLI
|
|
223
|
+
brew install fluxcd/tap/flux
|
|
224
|
+
|
|
225
|
+
# Bootstrap Flux with GitLab
|
|
226
|
+
flux bootstrap gitlab \
|
|
227
|
+
--hostname=${GITLAB_HOST} \
|
|
228
|
+
--token-auth \
|
|
229
|
+
--owner=path/to/group \
|
|
230
|
+
--repository=flux-config \
|
|
231
|
+
--branch=main \
|
|
232
|
+
--path=clusters/eks-nonprod
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Step 2: Configure Flux Source**
|
|
236
|
+
|
|
237
|
+
```yaml
|
|
238
|
+
# clusters/eks-nonprod/app-source.yaml
|
|
239
|
+
apiVersion: source.toolkit.fluxcd.io/v1
|
|
240
|
+
kind: GitRepository
|
|
241
|
+
metadata:
|
|
242
|
+
name: my-app
|
|
243
|
+
namespace: flux-system
|
|
244
|
+
spec:
|
|
245
|
+
interval: 1m
|
|
246
|
+
url: https://gitlab.example.com/path/to/my-app.git
|
|
247
|
+
ref:
|
|
248
|
+
branch: main
|
|
249
|
+
secretRef:
|
|
250
|
+
name: gitlab-token
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Step 3: Configure Kustomization**
|
|
254
|
+
|
|
255
|
+
```yaml
|
|
256
|
+
# clusters/eks-nonprod/app-kustomization.yaml
|
|
257
|
+
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
258
|
+
kind: Kustomization
|
|
259
|
+
metadata:
|
|
260
|
+
name: my-app
|
|
261
|
+
namespace: flux-system
|
|
262
|
+
spec:
|
|
263
|
+
interval: 5m
|
|
264
|
+
path: ./manifests
|
|
265
|
+
prune: true
|
|
266
|
+
sourceRef:
|
|
267
|
+
kind: GitRepository
|
|
268
|
+
name: my-app
|
|
269
|
+
targetNamespace: production
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### 5. Token Rotation
|
|
273
|
+
|
|
274
|
+
Agents can have maximum 2 active tokens. Rotate tokens without downtime:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# 1. Create new token (while old token is still active)
|
|
278
|
+
curl --request POST \
|
|
279
|
+
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
280
|
+
--header "Content-Type: application/json" \
|
|
281
|
+
--url "https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents/${AGENT_ID}/tokens" \
|
|
282
|
+
--data '{"name":"rotation-token","description":"Token rotation $(date +%Y%m%d)"}'
|
|
283
|
+
|
|
284
|
+
# 2. Update agent with new token
|
|
285
|
+
helm upgrade gitlab-agent gitlab/gitlab-agent \
|
|
286
|
+
--namespace gitlab-agent \
|
|
287
|
+
-f agent-values.yaml \
|
|
288
|
+
--set config.token="${NEW_TOKEN}"
|
|
289
|
+
|
|
290
|
+
# 3. Verify agent reconnects
|
|
291
|
+
kubectl logs -f -l=app.kubernetes.io/name=gitlab-agent -n gitlab-agent
|
|
292
|
+
|
|
293
|
+
# 4. Revoke old token
|
|
294
|
+
curl --request DELETE \
|
|
295
|
+
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
296
|
+
--url "https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents/${AGENT_ID}/tokens/${OLD_TOKEN_ID}"
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Troubleshooting Guide
|
|
302
|
+
|
|
303
|
+
### Common Issues
|
|
304
|
+
|
|
305
|
+
| Issue | Diagnosis | Solution |
|
|
306
|
+
| ------------------------------------------- | ----------------------------- | ------------------------------------------------------- |
|
|
307
|
+
| **WebSocket dial failed** | `lookup gitlab-kas on...` | Verify DNS resolution, check `kasAddress` configuration |
|
|
308
|
+
| **HTTP 301 on handshake** | Missing trailing slash | Ensure `kasAddress` ends with `/` |
|
|
309
|
+
| **Certificate signed by unknown authority** | Self-signed CA not trusted | Use `--set-file config.kasCaCert=ca.pem` |
|
|
310
|
+
| **Agent version mismatch** | Version warning in UI | Update agent to match GitLab version |
|
|
311
|
+
| **Decompressor not installed for gzip** | Version incompatibility | Ensure `agentk` and KAS versions match |
|
|
312
|
+
| **Failed to register agent pod** | Version/connectivity mismatch | Verify KAS is running: `gitlab-ctl status gitlab-kas` |
|
|
313
|
+
|
|
314
|
+
### Debug Commands
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# View agent logs
|
|
318
|
+
kubectl logs -f -l=app.kubernetes.io/name=gitlab-agent -n gitlab-agent
|
|
319
|
+
|
|
320
|
+
# Check agent pod status
|
|
321
|
+
kubectl describe pod -l=app.kubernetes.io/name=gitlab-agent -n gitlab-agent
|
|
322
|
+
|
|
323
|
+
# Verify agent configuration
|
|
324
|
+
kubectl get configmap -l=app=gitlab-agent -n gitlab-agent -o yaml
|
|
325
|
+
|
|
326
|
+
# Test connectivity to KAS
|
|
327
|
+
kubectl run curl-test --rm -it --restart=Never --image=curlimages/curl -- \
|
|
328
|
+
curl -v "https://${GITLAB_HOST}/-/kubernetes-agent/"
|
|
329
|
+
|
|
330
|
+
# List registered agents via API
|
|
331
|
+
curl --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
332
|
+
"https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents" | jq
|
|
333
|
+
|
|
334
|
+
# Check token status
|
|
335
|
+
curl --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
|
|
336
|
+
"https://${GITLAB_HOST}/api/v4/projects/${PROJECT_ID}/cluster_agents/${AGENT_ID}/tokens" | jq
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Self-Signed Certificate Fix
|
|
340
|
+
|
|
341
|
+
For on-prem GitLab with self-signed certificates:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Get the CA certificate from GitLab server
|
|
345
|
+
openssl s_client -connect ${GITLAB_HOST}:443 -showcerts </dev/null 2>/dev/null | \
|
|
346
|
+
openssl x509 -outform PEM > gitlab-ca.pem
|
|
347
|
+
|
|
348
|
+
# Install with CA
|
|
349
|
+
helm upgrade --install gitlab-agent gitlab/gitlab-agent \
|
|
350
|
+
--namespace gitlab-agent \
|
|
351
|
+
--set config.token="${AGENT_TOKEN}" \
|
|
352
|
+
--set config.kasAddress="wss://${GITLAB_HOST}/-/kubernetes-agent/" \
|
|
353
|
+
--set-file config.kasCaCert=./gitlab-ca.pem
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Reference Files
|
|
357
|
+
|
|
358
|
+
- **[references/agent_installation.md](references/agent_installation.md)** — Detailed installation and configuration guide
|
|
359
|
+
- **[references/gitops_flux.md](references/gitops_flux.md)** — Complete GitOps setup with Flux
|
|
360
|
+
- **[references/api_reference.md](references/api_reference.md)** — GitLab API endpoints for agent and project management
|
|
361
|
+
- **[references/troubleshooting.md](references/troubleshooting.md)** — Detailed troubleshooting scenarios
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## GitLab API Quick Reference
|
|
366
|
+
|
|
367
|
+
### Agent Management
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# List agents
|
|
371
|
+
GET /projects/:id/cluster_agents
|
|
372
|
+
|
|
373
|
+
# Get agent details
|
|
374
|
+
GET /projects/:id/cluster_agents/:agent_id
|
|
375
|
+
|
|
376
|
+
# Register agent
|
|
377
|
+
POST /projects/:id/cluster_agents
|
|
378
|
+
# Body: {"name":"agent-name"}
|
|
379
|
+
|
|
380
|
+
# Delete agent
|
|
381
|
+
DELETE /projects/:id/cluster_agents/:agent_id
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Token Management
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# List tokens (max 2 active)
|
|
388
|
+
GET /projects/:id/cluster_agents/:agent_id/tokens
|
|
389
|
+
|
|
390
|
+
# Create token
|
|
391
|
+
POST /projects/:id/cluster_agents/:agent_id/tokens
|
|
392
|
+
# Body: {"name":"token-name","description":"optional"}
|
|
393
|
+
|
|
394
|
+
# Revoke token
|
|
395
|
+
DELETE /projects/:id/cluster_agents/:agent_id/tokens/:token_id
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Project Management
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
# List projects
|
|
402
|
+
GET /projects?search=keyword
|
|
403
|
+
|
|
404
|
+
# Get project details
|
|
405
|
+
GET /projects/:id
|
|
406
|
+
|
|
407
|
+
# Create project
|
|
408
|
+
POST /projects
|
|
409
|
+
# Body: {"name":"project-name","namespace_id":123}
|
|
410
|
+
|
|
411
|
+
# Edit project
|
|
412
|
+
PUT /projects/:id
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Scripts
|
|
418
|
+
|
|
419
|
+
### Check Agent Health
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# Run agent health check
|
|
423
|
+
python skills/gitlab/scripts/gitlab_agent_status.py \
|
|
424
|
+
--namespace gitlab-agent \
|
|
425
|
+
--gitlab-url "https://${GITLAB_HOST}" \
|
|
426
|
+
--project-id ${PROJECT_ID} \
|
|
427
|
+
--output reports/gitlab/agent_health.json
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Generate Agent Values
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Generate Helm values file
|
|
434
|
+
python skills/gitlab/scripts/generate_agent_values.py \
|
|
435
|
+
--gitlab-url "https://${GITLAB_HOST}" \
|
|
436
|
+
--agent-name eks-nonprod-agent \
|
|
437
|
+
--ca-cert ./gitlab-ca.pem \
|
|
438
|
+
--output agent-values.yaml
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## Best Practices
|
|
444
|
+
|
|
445
|
+
### Security
|
|
446
|
+
|
|
447
|
+
1. **Use dedicated service account** — Don't use `cluster-admin` in production
|
|
448
|
+
2. **Rotate tokens regularly** — Use the 2-token limit for zero-downtime rotation
|
|
449
|
+
3. **Restrict CI/CD access** — Use impersonation for fine-grained RBAC
|
|
450
|
+
4. **Enable TLS** — Required for self-managed GitLab with KAS
|
|
451
|
+
|
|
452
|
+
### Production Configuration
|
|
453
|
+
|
|
454
|
+
```yaml
|
|
455
|
+
# production-values.yaml
|
|
456
|
+
replicaCount: 2
|
|
457
|
+
|
|
458
|
+
resources:
|
|
459
|
+
requests:
|
|
460
|
+
cpu: 100m
|
|
461
|
+
memory: 128Mi
|
|
462
|
+
limits:
|
|
463
|
+
cpu: 500m
|
|
464
|
+
memory: 256Mi
|
|
465
|
+
|
|
466
|
+
rbac:
|
|
467
|
+
create: true
|
|
468
|
+
useExistingRole: gitlab-agent-role # Pre-created restricted role
|
|
469
|
+
|
|
470
|
+
serviceAccount:
|
|
471
|
+
create: true
|
|
472
|
+
name: gitlab-agent
|
|
473
|
+
|
|
474
|
+
podDisruptionBudget:
|
|
475
|
+
enabled: true
|
|
476
|
+
minAvailable: 1
|
|
477
|
+
|
|
478
|
+
affinity:
|
|
479
|
+
podAntiAffinity:
|
|
480
|
+
preferredDuringSchedulingIgnoredDuringExecution:
|
|
481
|
+
- weight: 100
|
|
482
|
+
podAffinityTerm:
|
|
483
|
+
labelSelector:
|
|
484
|
+
matchLabels:
|
|
485
|
+
app.kubernetes.io/name: gitlab-agent
|
|
486
|
+
topologyKey: kubernetes.io/hostname
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Reliability
|
|
490
|
+
|
|
491
|
+
1. **Match versions** — Keep agent version aligned with GitLab version
|
|
492
|
+
2. **Monitor connectivity** — Alert on agent connection failures
|
|
493
|
+
3. **Use GitOps** — Prefer Flux over CI/CD for production deployments
|
|
494
|
+
4. **Backup config** — Store agent values in version control
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## Environment Configuration
|
|
499
|
+
|
|
500
|
+
Required environment variables for scripts:
|
|
501
|
+
|
|
502
|
+
```bash
|
|
503
|
+
export GITLAB_HOST="gitlab.example.com" # Your on-prem GitLab host
|
|
504
|
+
export GITLAB_TOKEN="glpat-xxxx" # Personal/project access token
|
|
505
|
+
export PROJECT_ID="123" # Project ID containing agent config
|
|
506
|
+
export AGENT_ID="1" # Agent ID (from registration)
|
|
507
|
+
export KUBECONFIG="~/.kube/config" # Kubernetes configuration
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
## Related Skills
|
|
513
|
+
|
|
514
|
+
- **[karpenter](../karpenter/SKILL.md)** — Node autoscaling for GitLab agent workloads
|
|
515
|
+
- **[aws](../aws/SKILL.md)** — Parent AWS skill for EKS cluster management
|
|
516
|
+
- **[consul](../consul/SKILL.md)** — Service mesh for applications deployed via GitOps
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
## External Resources
|
|
521
|
+
|
|
522
|
+
- [GitLab Agent for Kubernetes Documentation](https://docs.gitlab.com/user/clusters/agent/)
|
|
523
|
+
- [Installing the Agent](https://docs.gitlab.com/user/clusters/agent/install/)
|
|
524
|
+
- [GitOps with Flux](https://docs.gitlab.com/user/clusters/agent/gitops/)
|
|
525
|
+
- [CI/CD Workflow](https://docs.gitlab.com/user/clusters/agent/ci_cd_workflow/)
|
|
526
|
+
- [Kubernetes Agent API](https://docs.gitlab.com/api/cluster_agents/)
|
|
527
|
+
- [Troubleshooting Guide](https://docs.gitlab.com/user/clusters/agent/troubleshooting/)
|
|
528
|
+
- [GitLab Agent Helm Chart](https://gitlab.com/gitlab-org/charts/gitlab-agent)
|
|
529
|
+
- [FluxCD Documentation](https://fluxcd.io/flux/)
|