--- id: kopf version: "1.44.6" license: MIT license_treatment: permissive maintenance: active --- # kopf — Kubernetes Operator Pythonic Framework (Kopf) License: permissive · Maintenance: active · Downloads: 1.7M/mo ## What it is and what it does Kopf is a framework that simplifies Kubernetes operator development by letting you write domain logic in Python without infrastructure boilerplate. Instead of managing Kubernetes API calls and event loops directly, you decorate Python functions to respond to resource creation, updates, deletion, and other lifecycle events. The framework handles marshalling resource data into function arguments, persisting handler progress across restarts, retrying on failure, and publishing logs as Kubernetes events. It supports both synchronous and asynchronous handlers, timers, daemons, admission webhooks, and cross-operator coordination (peering). The framework is production-ready and stable; the maintainer has stated that the core design is complete with no major new functionality planned, though maintenance for new Python and Kubernetes versions continues regularly. Use it for: - Build a custom Kubernetes resource operator that automatically provisions or reconciles infrastructure when resources are created or modified. - Implement admission webhooks to validate or mutate custom resources before they are persisted to the cluster. - Run background daemons or periodic timers tied to individual resources, with automatic cleanup when resources are deleted. - Migrate domain logic from imperative scripts into a declarative operator that survives pod restarts and cluster disruptions. - Coordinate multiple Kopf-based operators on the same resource kinds to avoid duplicate processing and manage dev/prod operator switching. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Kopf is a Python framework for building Kubernetes operators with minimal boilerplate, using decorators to register event handlers that respond to changes in custom and built-in Kubernetes resources. Yes, if you are building Kubernetes operators in Python. Kopf eliminates boilerplate and provides a stable, actively maintained framework with a permissive license. The low install friction and support for current Python versions (3.10–3.14) make it a practical choice for production operators. No known vulnerabilities and 2631 GitHub stars indicate community confidence. ## Install pip install kopf uv add kopf poetry add kopf ## Installing kopf Before you install: Low friction install with a pure-Python wheel. Actively maintained as of June 2026 with no major feature development planned but regular maintenance for Python and Kubernetes compatibility. License in practice: MIT license permits commercial and private use with minimal restrictions; suitable for most deployment contexts. Quickstart: pip install kopf import kopf @kopf.on.create('kopfexamples') def create_fn(spec, name, **kwargs): print(f"Created {name} with spec: {spec}") # Run with: kopf run handlers.py Requires Python 3.10 or later (CPython or PyPy officially supported). Verify before relying: - Whether the six runtime dependencies (aiohttp, click, pyyaml, iso8601, jsonpatch, python-json-logger) are all required for basic operator functionality or only for specific features. - Performance characteristics and memory footprint under high-load scenarios, as the description mentions planned optimizations but does not quantify current behavior. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.7M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags kubernetes operator framework python, k8s operator development library, kubernetes custom resource handlers, operator automation python, k8s event-driven handlers, kubernetes domain logic framework, operator framework decorators, kubernetes, operators, infrastructure-as-code [View on SkillFed](https://skillfed.io/packages/kopf) · [View on PyPI](https://pypi.org/project/kopf/)