Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)29k ยท #9564

kubernetes-operator

Fungsinya

Skill ini memandu desain dan pemeriksaan operator Kubernetes, yaitu program yang mengelola resource kustom di dalam klaster. Cocok untuk insinyur yang membangun atau mengaudit controller semacam ini.

Kapan dipakai

  • โœ“Saat Anda sedang membangun operator Kubernetes baru untuk resource kustom.
  • โœ“Saat Anda ingin operator yang ada ditinjau dari finalizer yang hilang, status yang menyimpang, atau masalah izin.
  • โœ“Saat Anda perlu memilih framework seperti kubebuilder atau operator-sdk.

Link skill

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/kubernetes-operator/skills/kubernetes-operator/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/kubernetes-operator/skills/kubernetes-operator/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya ingin membangun operator Kubernetes yang mengelola backup database kami. Bantu saya merancangnya sebelum saya menulis controller-nya.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memvalidasi definisi resource, memeriksa control loop untuk bug yang umum, dan menilai tingkat kematangan operator dengan skrip pembantu.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Kubernetes Operator

Build operators that reconcile correctly. Most operator bugs are not Kubernetes bugs โ€” they are reconcile-loop bugs: missing finalizers, blocking calls, no requeue on transient errors, status drift, RBAC over-grants. This skill catches them deterministically before they reach a cluster.

When to use

  • Building a new Kubernetes Operator (controller for a CRD)
  • Reviewing an existing operator for capability-level gaps
  • Auditing a CRD spec for status/conditions/finalizer correctness
  • Choosing a framework (controller-runtime / kubebuilder / operator-sdk / metacontroller / KOPF)
  • Designing the API surface of a Custom Resource
  • Hardening RBAC, leader election, or webhook validation

When NOT to use

  • Plain Helm chart packaging โ†’ use helm-chart-builder
  • Standard kubectl operations / blue-green deploys โ†’ use senior-devops
  • General k8s security posture โ†’ use cloud-security
  • "I want to run a workload" โ€” that's a Deployment / Job, not an operator

Core principle: an operator is a reconcile loop, not a script

observe(actual) โ†’ desired = read(spec) โ†’ diff(actual, desired) โ†’ act โ†’ update(status)
                                                                          โ†“
                                                                   requeue / done

Operators that fail are the ones that:

  1. Treat reconcile as imperative (do this, then this, then this) instead of declarative (make actual=desired, idempotently)
  2. Don't requeue transient failures
  3. Don't use finalizers, leaving orphan resources
  4. Mutate spec instead of status
  5. Don't use the status subresource (status updates trigger spec reconciles โ†’ loop)
  6. Block in reconcile (long HTTP calls, locks)
  7. Forget leader election โ†’ split-brain on multi-replica deploys

The 3 tools below catch each of these.

Quick start

SKILL=engineering/kubernetes-operator/skills/kubernetes-operator

# Validate a CRD design
python "$SKILL/scripts/crd_validator.py" --crd config/crd/myapp.yaml

# Lint a Go reconcile function
python "$SKILL/scripts/reconcile_lint.py" --controller controllers/myapp_controller.go

# Score against OperatorHub Capability Levels (1-5)
python "$SKILL/scripts/operator_capability_audit.py" --operator-dir .

The 3 Python tools

All stdlib-only. Run with --help.

crd_validator.py

Validates a CRD YAML against operator-pattern best practices.

python scripts/crd_validator.py --crd config/crd/myapp.yaml
python scripts/crd_validator.py --crd config/crd/ --format json

Checks:

  • spec.versions[*].subresources.status is set (status subresource)
  • spec.scope is Namespaced (not Cluster) unless explicitly justified
  • Singular and listKind defined
  • spec.versions[*].schema.openAPIV3Schema has type definitions (no x-kubernetes-preserve-unknown-fields: true at top level)
  • A version is marked served: true AND storage: true
  • Conditions array is in the schema (allows metav1.Conditions)
  • Printer columns include Age and Status/Phase

reconcile_lint.py

Lints a Go controller reconcile function for anti-patterns.

python scripts/reconcile_lint.py --controller controllers/myapp_controller.go

Checks (regex-based heuristics):

  • Returns are (ctrl.Result, error) shape
  • Errors trigger a non-zero requeue (return ctrl.Result{Requeue: true}, err)
  • client.Update() on the spec object is flagged (controllers should update only status)
  • time.Sleep inside reconcile is flagged (use RequeueAfter)
  • HTTP calls without context cancellation are flagged
  • Missing defer after a finalizer add
  • No IsConditionTrue / SetCondition calls when conditions present in CRD
  • Reconcile function exceeds 80 lines (extract subroutines)

operator_capability_audit.py

Scores an operator against OperatorHub's 5 Capability Levels.

python scripts/operator_capability_audit.py --operator-dir .

Levels:

  • L1 โ€” Basic Install: CRD defined, controller deploys it
  • L2 โ€” Seamless Upgrades: PDBs, conversion webhooks, version skew strategy
  • L3 โ€” Full Lifecycle: backups, restores, failure recovery
  • L4 โ€” Deep Insights: metrics endpoint, Prometheus rules, alerts
  • L5 โ€” Auto Pilot: auto-scaling, auto-tuning, anomaly detection

Reports current level + concrete next steps to advance one level.

Tooling landscape

Pick a framework based on language and complexity. See references/tooling_landscape.md.

| Framework | Language | Best for

Pertanyaan umum

Apa itu operator?

Itu adalah program yang mengawasi resource Kubernetes dan menjaga sistem sungguhan sesuai dengan yang dijelaskan resource tersebut.

Apakah ini untuk menjalankan aplikasi biasa?

Tidak. Aplikasi biasa berjalan sebagai Deployment atau Job, dan skill ini untuk membangun controller kustom.

Bug umum apa yang dicari?

Finalizer yang hilang, pemanggilan yang memblokir, tidak ada percobaan ulang untuk error sementara, status yang menyimpang, dan izin yang terlalu luas.

Detail

Deskripsi asli dari pembuat

Use when building a Kubernetes operator or CRD (controller-runtime, kubebuilder, operator-sdk, KOPF), before writing the controller. Validates CRDs with crd_validator.py, lints reconcile loops with reconcile_lint.py and scores OperatorHub capability level.

repo: alirezarezvani/claude-skills

Popularitas

Bintang GitHub
29k
Peringkat
#9564
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa