ocaml-kube

A native OCaml 5 client and controller runtime for Kubernetes®.

The current release is v0.1.2. The public API is usable, but may still evolve between minor releases while the project is in the 0.x series.

Highlights

Install

OCaml 5.1 or newer and OPAM are required. Install the released package with:

opam install kube

The OPAM package installs the kube libraries and the ocaml-kube scaffolding command.

Build from source

To build the development checkout with its tests and API documentation:

opam install . --deps-only --with-test --with-doc
opam exec -- dune build @all @install @doc @codegen-check
opam exec -- dune runtest

See Getting started for client setup, a typed request, and the local integration example.

Libraries

Library

Purpose

kube

Configuration, transport, clients, discovery, caching, and controllers

kube.api.v1_34kube.api.v1_37

Versioned generated Kubernetes APIs

kube.crd

Typed custom resources and CRD generation

kube.ppx

JSON codec and structural schema derivation

kube.test

Deterministic client and controller testing

Documentation

Guide

Covers

Getting started

Build, configuration, and first request

Client APIs

Typed, dynamic, subresource, and streaming clients

Sensitive transport

Protected credentials, bodies, Secret writes, and TokenRequest

Controller runtime

Reconciliation, caching, watches, and leadership

Operator patterns

Owned children, apply, retries, conditions, metrics, and tests

Operations

Logging, health, metrics, diagnostics, and events

Compatibility

Supported Kubernetes versions and feature floor

Generated APIs

API packages, versioning, and regeneration

Custom resources

CRD schemas, codecs, and typed resources

Operator scaffolding

OCaml-first generation and CRD import

Streaming

Exec, attach, and port forwarding

Webhooks

Admission, conversion, and TLS serving

Testing

Scripted transports and integration boundaries

Client-go and Rust comparison

Current parity, honest gaps, and priorities

Why OCaml?

Strengths, tradeoffs, and when to choose it

Release history is in CHANGES.md. See CONTRIBUTING.md, SECURITY.md, and the release checklist for project processes.

Licensed under Apache-2.0.