text stringlengths 0 37.6k |
|---|
# HorizontalPodAutoscaler v2 — CPU + Memory metrics |
apiVersion: autoscaling/v2 |
kind: HorizontalPodAutoscaler |
metadata: |
name: php-apache-hpa |
namespace: default |
spec: |
scaleTargetRef: |
apiVersion: apps/v1 |
kind: Deployment |
name: php-apache |
minReplicas: 1 |
maxReplicas: 10 |
metrics: |
- type: Resource |
resource: |
name: cpu |
target: |
type: Utilization |
averageUtilization: 50 |
- type: Resource |
resource: |
name: memory |
target: |
type: AverageValue |
averageValue: 200Mi |
behavior: |
scaleDown: |
stabilizationWindowSeconds: 300 |
policies: |
- type: Percent |
value: 100 |
periodSeconds: 15 |
scaleUp: |
stabilizationWindowSeconds: 0 |
policies: |
- type: Percent |
value: 100 |
periodSeconds: 15 |
- type: Pods |
value: 4 |
periodSeconds: 15 |
selectPolicy: Max |
<|endoftext|> |
# StatefulSet — Kafka cluster com PVC e headless service |
apiVersion: apps/v1 |
kind: StatefulSet |
metadata: |
name: kafka |
namespace: kafka |
spec: |
serviceName: kafka-headless |
replicas: 3 |
selector: |
matchLabels: |
app: kafka |
template: |
metadata: |
labels: |
app: kafka |
spec: |
terminationGracePeriodSeconds: 30 |
containers: |
- name: kafka |
image: confluentinc/cp-kafka:7.4.0 |
ports: |
- containerPort: 9092 |
name: kafka |
- containerPort: 9093 |
name: controller |
env: |
- name: KAFKA_BROKER_ID |
valueFrom: |
fieldRef: |
fieldPath: metadata.name |
- name: KAFKA_ZOOKEEPER_CONNECT |
value: "zookeeper:2181" |
resources: |
requests: |
memory: "512Mi" |
cpu: "250m" |
limits: |
memory: "1Gi" |
cpu: "500m" |
volumeMounts: |
- name: kafka-data |
mountPath: /var/lib/kafka/data |
volumeClaimTemplates: |
- metadata: |
name: kafka-data |
spec: |
accessModes: ["ReadWriteOnce"] |
storageClassName: standard |
resources: |
requests: |
storage: 10Gi |
<|endoftext|> |
# StatefulSet — PostgreSQL com PVC |
apiVersion: apps/v1 |
kind: StatefulSet |
End of preview. Expand in Data Studio
K8s RAG Corpus
A curated corpus of 4,794 Kubernetes-specific documents (7.5MB) used as the retrieval index for the BM25 RAG component of the K8s Multi-Agent Debate system.
Contents
| Source | Documents |
|---|---|
| Official k8s.io examples (kubernetes/website) | ~200 |
| Helm chart examples | ~150 |
| Flux CD / HelmRelease examples | ~100 |
| ArgoCD Application templates | ~100 |
| RBAC, NetworkPolicy, HPA patterns | ~200 |
| Curated hardcoded examples (29 complex patterns) | 29 |
| Local production YAML files | 5,443 |
| Total | ~4,794 indexed docs |
Key Patterns Covered
- HPA v2 with CPU/memory metrics
- StatefulSet with volumeClaimTemplates
- Ingress with TLS + pathType
- PVC with StorageClass
- CronJob with restartPolicy
- NetworkPolicy with ingress/egress rules
- ClusterRole + ClusterRoleBinding
- HelmRelease (Flux CD)
- Kustomization overlays
- ArgoCD Application with syncPolicy
- Multi-container pods with sidecars
- Resource limits and requests
Format
Plain text, one document per line, with ---DOC--- separator between documents.
Used with rank-bm25 (BM25Okapi) for retrieval.
Usage
from rank_bm25 import BM25Okapi
import re
with open("rag_k8s.txt") as f:
raw = f.read()
docs = [d.strip() for d in raw.split("---DOC---") if d.strip()]
tokenized = [re.findall(r"[\w:/.-]+", d.lower()) for d in docs]
bm25 = BM25Okapi(tokenized)
query = "HorizontalPodAutoscaler cpu utilization"
tokens = re.findall(r"[\w:/.-]+", query.lower())
top3 = bm25.get_top_n(tokens, docs, n=3)
Paper
Brasil, R. (2025). Can Small Domain-Specific LLMs Compete with General 7B Models on Kubernetes Configuration Generation? Code: https://github.com/roanbrasil/llm-pocs
Related
- K8sBench benchmark: https://huggingface.co/datasets/roanbrasil/k8sbench
- MDA Demo: https://huggingface.co/spaces/roanbrasil/k8s-multi-agent
- AttnRes model: https://huggingface.co/roanbrasil/attnres-devops-gpt
- Downloads last month
- 19