kubernets api 调用实战 php客户端

php客户端使用方法

安装Installation using Composer


// 在这里编写代码
$ composer require maclof/kubernetes-client

支持的版本列表 Supported API Features


截止20200429

// 在这里编写代码
v1
Nodes
Namespaces
Pods
Replica Sets
Replication Controllers
Services
Secrets
Events
Config Maps
Endpoints
Persistent Volume
Persistent Volume Claims
batch/v1
Jobs
batch/v1beta1
Cron Jobs
apps/v1
Deployments
extensions/v1beta1
Daemon Sets
Ingresses
networking.k8s.io/v1
Network Policies
certmanager.k8s.io/v1alpha1
Certificates
Issuers




方法及对应的类

调用例子 Basic Usage

<?php

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

use MaclofKubernetesClient;

$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();

文档地址:

https://github.com/maclof/kubernetes-client

发表评论

您的电子邮箱地址不会被公开。