advanced-kubernetes
БесплатноЗапускает вложенные скриптыНе проверенCustom Resource Definitions (CRDs) extend Kubernetes API with custom object types. Operators are controllers that manage these custom resources using…
Об этом скилле
Advanced Kubernetes: Operators & CRDs
Level 1: Quick Reference
Core Concepts at a Glance
Custom Resource Definitions (CRDs) extend Kubernetes API with custom object types. Operators are controllers that manage these custom resources using domain-specific logic.
CRD vs ConfigMap Comparison:
| Aspect | CRD | ConfigMap |
|---|---|---|
| API Integration | Full Kubernetes API support (CRUD, watch, RBAC) | Simple key-value storage |
| Validation | OpenAPI v3 schema validation, admission webhooks | No built-in validation |
| Versioning | Multiple versions with conversion webhooks | Single version only |
| Use Case | Complex application state, declarative APIs | Configuration data, environment variables |
| Controller Support | Reconciliation loops, status tracking | Manual polling required |
| Example | Database instances, ML workflows, backup policies | App config files, feature flags |
Operator Pattern Overview
┌─────────────────────────────────────────────────────────┐
│ Kubernetes API Server │
│ (stores desired state in etcd) │
└────────────┬────────────────────────────┬───────────────┘
│ │
│ Watch │ Update Status
↓ ↑
┌────────────────┐ ┌─────────────────────┐
│ Controller │────────→│ External Resources │
│ (Reconcile) │ Manage │ (DBs, APIs, etc.) │
└────────────────┘ └─────────────────────┘
↑
│ Compare
│
┌────┴─────┐
│ Desired │
│ vs Actual│
└──────────┘
Reconciliation Loop:
- Watch - Controller watches for changes to custom resources
- Compare - Reconcile function compares desired vs actual state
- Act - Controller takes actions to align actual state with desired
- Update Status - Controller updates resource status with current state
- Requeue - Schedule next reconciliation (periodic or event-driven)
Controller Reconciliation Logic
// Simplified reconciliation pattern
func (r *MyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
// 1. Fetch the custom resource
obj := &myapi.MyResource{}
if err := r.Get(ctx, req.NamespacedName, obj); err != nil {
return ctrl.Result{}, client.IgnoreNotFound(err)
}
// 2. Handle deletion (finalizers)
if !obj.DeletionTimestamp.IsZero() {
return r.handleDeletion(ctx, obj)
}
// 3. Reconcile external state
if err := r.reconcileExternal(ctx, obj); err != nil {
return ctrl.Result{}, err
}
// 4. Update status
obj.Status.Ready = true
if err := r.Status().Update(ctx, obj); err != nil {
return ctrl.Result{}, err
}
return ctrl.Result{}, nil // Success, no requeue
}
Essential Checklist
Prerequisites:
- Kubernetes cluster (v1.25+) - local (kind, minikube) or remote
- kubectl configured with admin access
- Go 1.21+ installed
- Docker/Podman for building operator images
Development Tools:
-
kubebuilder(v3.12+) - scaffolding and code generation -
operator-sdk(optional) - alternative framework -
controller-gen- generates CRDs, RBACs, webhooks -
kustomize- manages Kubernetes manifests
Testing Tools:
-
envtest- runs API server locally for unit tests -
kind- Kubernetes in Docker for integration tests -
ginkgo- BDD testing framework (optional)
Key Files in Operator Project:
my-operator/
├── api/v1/ # CRD definitions (Go structs)
├── config/
│ ├── crd/ # Generated CRD YAML
│ ├── rbac/ # Generated RBAC YAML
│ ├── manager/ # Operator deployment
│ └── webhook/ # Webhook configurations
├── controllers/ # Reconciliation logic
├── main.go # Entrypoint (manager setup)
└── Dockerfile # Container image build
Quick Commands:
# Initialize operator project
kubebuilder init --domain example.com --repo github.com/myorg/my-operator
# Create CRD + controller
kubebuilder create api --group apps --version v1 --kind MyApp
# Generate manifests
make manifests
# Run locally (connects to current kubeconfig cluster)
make install run
# Run tests
make test
# Build and deploy
make docker-build docker-push deploy IMG=myregistry/my-operator:v1.0.0
Common Pitfalls:
- ❌ Forgetting to update CRD when changing API structs → run
make manifests - ❌ Infinite reconciliation loops → use
ctrl.Result{RequeueAfter: time.Minute} - ❌ Not handling deletion properly → implement finalizers
- ❌ Blocking operations in reconcile → use background workers for long tasks
- ❌ Not setting owner references → orphaned resources on deletion
When to Use Operators:
- ✅ Managing complex stateful applications (databases, message queues)
- ✅ Automatin
Установить advanced-kubernetes в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл advanced-kubernetes?
Custom Resource Definitions (CRDs) extend Kubernetes API with custom object types. Operators are controllers that manage these custom resources using domain-specific logic.
Как установить скилл advanced-kubernetes?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл advanced-kubernetes запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic