PHP code example of k8s / http-symfony

1. Go to this page and download the library: Download k8s/http-symfony library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

k8s / http-symfony example snippets


use K8s\Client\K8sFactory;

# Load the client from the default KubeConfig
$k8s = (new K8sFactory())->loadFromKubeConfig();

use K8s\HttpSymfony\ClientFactory;
use K8s\Client\K8sFactory;

# Pass any Symfony HTTP client options here.
# The below would allow for self-signed certificates.
$httpFactory = new ClientFactory([
    'verify_peer' => false,
    'verify_host' => false,
]);

$k8s = (new K8sFactory())->loadFromKubeConfig(null, $httpFactory);