PHP code example of benagricola / eks-auth
1. Go to this page and download the library: Download benagricola/eks-auth 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/ */
benagricola / eks-auth example snippets
use EKSAuth\Client\Factory as ClientFactory;
# Example using maclof/kubernetes-client
use Maclof\Kubernetes\Client;
// Create a new ClientFactory.
// EKS Cluster details are cached for the
// lifetime of this Factory instance.
$cf = new ClientFactory();
// Get our client. A new Token will be generated every
// time getClient() is called.
// We pass our own function that instantiates a new
// Maclof\Kubernetes\Client instance with the
// pre-configured \GuzzleHttp\Client.
$k8s = $cf->getClient($clusterName, $region, function($httpClient) {
return new Client([], $httpClient);
});
$namespaces = $k8s->namespaces()->find();
...