skillfed

kopf

Kubernetes Operator Pythonic Framework (Kopf)

kopf v1.44.6 1.7M downloads/30d#3,610 on PyPI2,631
Permissive license MIT Active released

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 on this page — 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

kopf on PyPI

pip

pip install kopf

uv

uv add kopf

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 6 — python-json-logger, jsonpatch, iso8601, pyyaml, click, aiohttp
Maintenance actively maintained — 72 days since the last release
Last repo commit
First released
Downloads 1,729,170/month — #3,610 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: kopf-1.44.6-py3-none-any.whl

Keywords: kubernetes, operator, framework, python, k8s

Intended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries

Tags

kubernetes operator framework pythonk8s operator development librarykubernetes custom resource handlersoperator automation pythonk8s event-driven handlerskubernetes domain logic frameworkoperator framework decorators
kubernetesoperatorsinfrastructure-as-code

More Libraries packages