Ryank90 / kubernetes-client

A simple yet elegant client for accessing and controlling a Kubernetes cluster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubernetes Client

Build Status

A PHP client for managing a Kubernetes cluster.

Installation using Composer

$ composer require maclof/kubernetes-client

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

use Maclof\Kubernetes\Client;

$client = new Client([
	'master' => 'http://master.mycluster.com',
]);

// Find pods by label selector
$pods = $client->pods()->setLabelSelector([
	'name'    => 'test',
	'version' => 'a',
])->find();

// Find pods by field selector
$pods = $client->pods()->setFieldSelector([
	'metadata.name' => 'test',
])->find();

// Find first pod with label selector (same for field selector)
$pod = $client->pods()->setLabelSelector([
	'name' => 'test',
])->first();

// Find various resources (most support label / field selectors)
$nodes = $client->nodes()->find();
$replicationControllers = $client->replicationControllers()->find();
$services = $client->services()->find();
$secrets = $client->secrets()->find();
$jobs = $client->jobs()->find();
$deployments = $client->deployments()->find();

About

A simple yet elegant client for accessing and controlling a Kubernetes cluster.


Languages

Language:PHP 100.0%