Laravel

Just a simple port of renoki-co/php-k8s for easier access in Laravel.

๐Ÿš€ Installation

You can install the package via composer:

composer require renoki-co/laravel-php-k8s

Publish the config:

php artisan vendor:publish --provider="RenokiCo\LaravelK8s\LaravelK8sServiceProvider" --tag="config"

๐Ÿ™Œ Usage

The cluster configuration can be found in the config/k8s.php file. You can get started directly with the /.kube/config file you already have.

use RenokiCo\LaravelK8s\LaravelK8sFacade as K8s;

foreach (K8s::getAllConfigMaps() as $cm) {
    // $cm->getName();
}

For further documentation, check renoki-co/php-k8s.

Multiple connections

The package supports multiple connections configurations. If you wish to select a specific one (not the default one), call connection before getting the cluster.

use RenokiCo\LaravelK8s\LaravelK8sFacade as K8s;

$cluster = K8s::connection('http')->getCluster();

Getting the cluster instance

You can also call getCluster() to get the instance of \RenokiCo\PhpK8s\KubernetesCluster:

$cluster = K8s::getCluster();

Last updated