Search by

roundly-consulting / kubernetes-api-for-laravel

mihaliak

A fluent, Eloquent-style client for the Kubernetes API in Laravel.

Package info

github.com/roundly-consulting/kubernetes-api-for-laravel

pkg:composer/roundly-consulting/kubernetes-api-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:13 UTC

This package is auto-updated.

Last update: 2026-10-03 18:35:09 UTC


README

Kubernetes API for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Kubernetes API for Laravel

A fluent, Eloquent-style client for the Kubernetes API in Laravel. Talk to one or many clusters through a chainable API built on Laravel's HTTP client, with the core Kubernetes resources, Traefik CRDs and your own custom resources built in.

Installation

Requires PHP 8.4, Laravel 12 or 13.

composer require roundly-consulting/kubernetes-api-for-laravel

Point it at your cluster with KUBERNETES_URL and KUBERNETES_TOKEN in .env.

Usage

List, create, scale and restart resources in one namespace of the default cluster:

use RoundlyConsulting\KubernetesApi\Facades\Kubernetes;
use RoundlyConsulting\KubernetesApi\Resources\Pod;
use RoundlyConsulting\KubernetesApi\Resources\Types\Container;

$shop = Kubernetes::namespace('shop');                       // every request stays in `shop`

$pods = $shop->pods()->whereLabel('app', 'web')->get();      // a collection of Pod resources

$shop->deployments()
    ->setName('checkout')
    ->setReplicas(3)
    ->setPodsSelectors(['app' => 'checkout'])
    ->setTemplate(Pod::make()
        ->setLabels(['app' => 'checkout'])
        ->setContainers([Container::make()->setName('app')->setImage('nginx', '1.27-alpine')]))
    ->create();

$shop->deployments()->withName('checkout')->scale(5);         // via the /scale subresource
$shop->deployments()->withName('checkout')->rolloutRestart(); // like `kubectl rollout restart`

Reach any other cluster the same way:

Kubernetes::cluster('production')->nodes()->get();           // a cluster from config/kubernetes.php
Kubernetes::fromKubeConfig(context: 'staging')->pods()->get(); // a kubeconfig context
Kubernetes::ping();                                          // does the apiserver answer?

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/kubernetes-api-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.