Download the PHP package k8s/client without Composer

On this page you can find all versions of the php package k8s/client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package client

k8s-client codecov

k8s-client is a Kubernetes API client for PHP.

The Kind models are auto-generated nightly for the last 10 versions of the Kubernetes API.

Installation

Install using composer:

This library requires a PSR-18 compatible HTTP Client, such as Guzzle or Symfony's HttpClient. It can also be given a PSR-16 compatible Simple Cache implementation to help speed up the library.

Using a Specific Kubernetes API version

Each Kubernetes version may have different resources and operations. If you require a specific version, then you can require the version of the k8s/api library that you need to use. That library contains all the API specific versions and models that are consumed by this library.

For instance, to use API version 1.18:

composer require k8s/api:"~1.18.0"

Note: The version of k8s/api does not exactly reflect the version of the Kubernetes API. The patch version of Kubernetes may not be the same as the k8s/api patch version.

Installing a Websocket Adapter

Certain Kuberenetes API endpoints (such as exec, to run commands in a container) require websockets to communicate. If you need support for this, install one of these adapters:

See each library's readme for more configuration information.

Constructing the Client Automatically

The easiest way to construct the client is from a pre-defined KubeConfig:

Note: This requires the use of an HttpClient factory helper. Install one of these packages:

Constructing the Client Manually

Construct the client with your needed options:

Note: If you need to perform certificate based authentication, check the options for the HttpClient you are using. Also check the configuration for the websocket adapter you are using.

Examples

List all Pods

Watch all Deployments in a Namespace

Create a Pod

Using model classes:

Using array data:

Create a Deployment

Using model classes:

Using array data:

Proxy HTTP requests to a Pod

The proxy method sends an HTTP request to a path of a pod, service, or node. It makes no assumptions about what type of HTTP request you want to send, so it accepts a standard PSR-7 RequestInterface and returns a ResponseInterface.

Get Logs for a Pod

Follow Logs for a Pod

Execute a command in a Pod container

Attach to the running process of a container in a Pod

Patch a Deployment

Upload Files to a Pod

Download Files from a Pod

Port Forwarding from a Pod

Note: The below example assumes a pod called portforward-example exists with port 80 serving HTTP (such as a base nginx image).

Create a class that reacts to port forwarding events:

Use the above class as a handler for the port forward process:


All versions of client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-json Version *
doctrine/annotations Version ^1.0
k8s/api Version *
k8s/core Version ^1.3
klkvsk/json-decode-stream Version ^1.0
php-http/discovery Version ^1.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/simple-cache Version ^1.0
symfony/yaml Version >=3.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package k8s/client contains the following files

Loading the files please wait ....