
Questo client fornisce accesso alle API REST complete di Kubernetes e OpenShift tramite un DSL fluente.
Il modo più semplice per creare un client è:```java KubernetesClient client = new DefaultKubernetesClient();
`DefaultOpenShiftClient` implementa entrambe le interfacce `KubernetesClient` e `OpenShiftClient`, quindi se hai bisogno
delle estensioni OpenShift, come i `Build`s, ecc., allora basta fare:```java
OpenShiftClient osClient = new DefaultOpenShiftClient();
Il client userà le impostazioni da diverse fonti nel seguente ordine di priorità:
Le proprietà di sistema sono preferite rispetto alle variabili d'ambiente. Le seguenti proprietà di sistema e variabili d'ambiente possono essere utilizzate per la configurazione:
In alternativa puoi usare ConfigBuilder per creare un oggetto di configurazione per il client Kubernetes:```java
Config config = new ConfigBuilder().withMasterUrl("https://mymaster.com").build();
KubernetesClient client = new DefaultKubernetesClient(config);
L'uso del DSL è lo stesso per tutte le risorse.
Elenca le risorse:```java
NamespaceList myNs = client.namespaces().list();
ServiceList myServices = client.services().list();
ServiceList myNsServices = client.services().inNamespace("default").list();
Ottieni una risorsa:```java Namespace myns = client.namespaces().withName("myns").get();
Service myservice = client.services().inNamespace("default").withName("myservice").get();
Elimina:```java
Namespace myns = client.namespaces().withName("myns").delete();
Service myservice = client.services().inNamespace("default").withName("myservice").delete();
La modifica delle risorse utilizza i builder inline del Kubernetes Model:```java Namespace myns = client.namespaces().withName("myns").edit(n -> new NamespaceBuilder(n) .editMetadata() .addToLabels("a", "label") .endMetadata() .build());
Service myservice = client.services().inNamespace("default").withName("myservice").edit(s -> new ServiceBuilder(s) .editMetadata() .addToLabels("another", "label") .endMetadata() .build());
Nello stesso spirito puoi inserire i builder inline per creare:```java
Namespace myns = client.namespaces().create(new NamespaceBuilder()
.withNewMetadata()
.withName("myns")
.addToLabels("a", "label")
.endMetadata()
.build());
Service myservice = client.services().inNamespace("default").create(new ServiceBuilder()
.withNewMetadata()
.withName("myservice")
.addToLabels("another", "label")
.endMetadata()
.build());
Puoi anche impostare l'apiVersion della risorsa come nel caso di SecurityContextConstraints :```java SecurityContextConstraints scc = new SecurityContextConstraintsBuilder() .withApiVersion("v1") .withNewMetadata().withName("scc").endMetadata() .withAllowPrivilegedContainer(true) .withNewRunAsUser() .withType("RunAsAny") .endRunAsUser() .build();
### Seguire gli eventi
Usa `io.fabric8.kubernetes.api.model.Event` come T per Watcher:```java
client.events().inAnyNamespace().watch(new Watcher<Event>() {
@Override
public void eventReceived(Action action, Event resource) {
System.out.println("event " + action.name() + " " + resource.toString());
}
@Override
public void onClose(KubernetesClientException cause) {
System.out.println("Watcher close due to " + cause);
}
});
L'API di Kubernetes definisce una serie di estensioni come daemonSets, jobs, ingresses e così via, tutte utilizzabili nel DSL extensions():
ad esempio, per elencare i jobs...``` jobs = client.batch().jobs().list();
### Caricamento di risorse da fonti esterne
Ci sono casi in cui si desidera leggere una risorsa da una fonte esterna, piuttosto che definirla utilizzando il DSL dei client.
In questi casi il client consente di caricare la risorsa da:
- Un file *(Supporta sia java.io.File che java.lang.String)*
- Un URL
- Un flusso di input
Una volta caricata la risorsa, puoi trattarla come se l'avessi creata tu stesso.
Ad esempio, leggiamo un pod da un file yml e lavoriamoci:
Pod refreshed = client.load('/path/to/a/pod.yml').fromServer().get();
Boolean deleted = client.load('/workspace/pod.yml').delete();
LogWatch handle = client.load('/workspace/pod.yml').watchLog(System.out);
### Passaggio di un riferimento di una risorsa al client
Nello stesso spirito puoi utilizzare un oggetto creato esternamente (sia un riferimento che la sua rappresentazione testuale).
Ad esempio:
Pod pod = someThirdPartyCodeThatCreatesAPod();
Boolean deleted = client.resource(pod).delete();
### Adattamento del client
Il client supporta adattatori collegabili. Un esempio di adattatore è l'[OpenShift Adapter](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/HEAD/openshift-client/src/main/java/io/fabric8/openshift/client/OpenShiftExtensionAdapter.java)
che consente di adattare un'istanza esistente di [KubernetesClient](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/HEAD/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/KubernetesClient.java) a un [OpenShiftClient](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/HEAD/openshift-client/src/main/java/io/fabric8/openshift/client/OpenShiftClient.java).
Ad esempio:```java
KubernetesClient client = new DefaultKubernetesClient();
OpenShiftClient oClient = client.adapt(OpenShiftClient.class);
Il client supporta anche il metodo isAdaptable() che verifica se l'adattamento è possibile e restituisce true se lo è.```java KubernetesClient client = new DefaultKubernetesClient(); if (client.isAdaptable(OpenShiftClient.class)) { OpenShiftClient oClient = client.adapt(OpenShiftClient.class); } else { throw new Exception("Adapting to OpenShiftClient not support. Check if adapter is present, and that env provides /oapi root path."); }
#### Adattamento e chiusura
Nota: quando si usa adapt(), sia l'adaptee che il target condividono le stesse risorse (client http sottostante, pool di thread, ecc.).
Ciò significa che non è necessario chiamare close() su ogni singola istanza creata tramite adapt.
Chiamare close() su una qualsiasi delle istanze gestite da adapt() o sull'istanza originale pulirà correttamente tutte le risorse e quindi nessuna delle istanze sarà più utilizzabile.
## Simulare Kubernetes
Oltre al client, questo progetto fornisce anche un server mock di kubernetes che puoi utilizzare per scopi di test.
Il server mock si basa su `https://github.com/square/okhttp/tree/master/mockwebserver` ma è potenziato dal DSL e dalle funzionalità fornite da `https://github.com/fabric8io/mockwebserver`.
Il Mock Web Server ha due modalità di funzionamento:
- Modalità Expectations
- Modalità CRUD
### Modalità Expectations
È la modalità tipica in cui prima si impostano quali sono le richieste http attese e quali dovrebbero essere le risposte per ciascuna richiesta.
Maggiori dettagli sull'utilizzo sono disponibili all'indirizzo: https://github.com/fabric8io/mockwebserver
Questa modalità è stata ampiamente utilizzata per testare il client stesso. Assicurati di controllare [kubernetes-test](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/HEAD/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock).
Per aggiungere un server Kubernetes al tuo test:```java
@Rule
public KubernetesServer server = new KubernetesServer();
Definire ogni singola richiesta e risposta può diventare noioso. Dato che nella maggior parte dei casi il server web simulato viene utilizzato per eseguire semplici operazioni basate su crud, è stata aggiunta una modalità crud. Quando si utilizza la modalità crud, il server web simulato memorizzerà, leggerà, aggiornerà ed eliminerà le risorse Kubernetes utilizzando una mappa in memoria e apparirà come un vero server API.
Per aggiungere un server Kubernetes in modalità crud al tuo test:```java @Rule public KubernetesServer server = new KubernetesServer(true, true);
Poi puoi usare il server così:```java
@Test
public void testInCrudMode() {
KubernetesClient client = server.getClient();
final CountDownLatch deleteLatch = new CountDownLatch(1);
final CountDownLatch closeLatch = new CountDownLatch(1);
//CREATE
client.pods().inNamespace("ns1").create(new PodBuilder().withNewMetadata().withName("pod1").endMetadata().build());
//READ
podList = client.pods().inNamespace("ns1").list();
assertNotNull(podList);
assertEquals(1, podList.getItems().size());
//WATCH
Watch watch = client.pods().inNamespace("ns1").withName("pod1").watch(new Watcher<Pod>() {
@Override
public void eventReceived(Action action, Pod resource) {
switch (action) {
case DELETED:
deleteLatch.countDown();
break;
default:
throw new AssertionFailedError(action.toString().concat(" isn't recognised."));
}
}
@Override
public void onClose(KubernetesClientException cause) {
closeLatch.countDown();
}
});
//DELETE
client.pods().inNamespace("ns1").withName("pod1").delete();
//READ AGAIN
podList = client.pods().inNamespace("ns1").list();
assertNotNull(podList);
assertEquals(0, podList.getItems().size());
assertTrue(deleteLatch.await(1, TimeUnit.MINUTES));
watch.close();
assertTrue(closeLatch.await(1, TimeUnit.MINUTES));
}
Puoi utilizzare il meccanismo di mocking di KubernetesClient con JUnit5. Poiché non supporta @Rule e @ClassRule, esiste un'annotazione dedicata @EnableKubernetesMockClient.
Se desideri creare un'istanza di KubernetesClient mockato per ogni test (JUnit4 @Rule), devi dichiarare un'istanza di KubernetesClient come mostrato di seguito.```java
@EnableKubernetesMockClient
class ExampleTest {
KubernetesClient client;
@Test
public void testInStandardMode() {
...
}
}
Nel caso in cui desideri definire un'istanza statica del server mockato per tutti i test (JUnit4 `@ClassRule`), devi dichiarare un'istanza di `KubernetesClient` come mostrato di seguito.
Puoi anche abilitare crudMode utilizzando il campo dell'annotazione `crud`.```java
@EnableKubernetesMockClient(crud = true)
class ExampleTest {
static KubernetesClient client;
@Test
public void testInCrudMode() {
...
}
}
Nota: Questa matrice è stata preparata eseguendo i nostri test di integrazione su diverse versioni di OpenShift.
Tutti gli oggetti risorsa qui utilizzati saranno conformi a OpenShift 3.9.0 e Kubernetes 1.9.0. Tutti gli oggetti risorsa forniranno tutti i campi secondo OpenShift 3.9.0 e Kubernetes 1.9.0.
batch che in extensions (Extensions è deprecato)apps che in extensions (Extensions è deprecato)apps che in extensions (Extensions è deprecato)apps che in extensions (Extensions è deprecato)network che in extensions (Extensions è deprecato)client base DSL a storage DSLclient base DSL e a solo Estensioni:
Framework/Librerie/Strumenti:
Plugin CI:
Strumenti di build:
Piattaforme:
Piattaforme proprietarie:
Man mano che la nostra community cresce, vorremmo tenere traccia dei nostri utenti. Invia una PR con il nome della tua organizzazione/comunità.
Qui ci sono i link di GitHub Actions e Jenkins per i test che vengono eseguiti per ogni nuova Pull Request. Puoi visualizzare anche tutte le build recenti.
Per ricevere aggiornamenti sulle release, puoi unirti a https://groups.google.com/forum/embed/?place=forum/fabric8-devclients## Equivalenti Java di Kubectl
Questa tabella fornisce le corrispondenze tra kubectl e Kubernetes Java Client. La maggior parte delle corrispondenze è piuttosto semplice e si tratta di operazioni di una
riga. Tuttavia, alcune potrebbero richiedere un po' più di codice per ottenere lo stesso risultato:
| Proprietà / Variabile d'ambiente | Descrizione | Valore predefinito |
|---|
kubernetes.disable.autoConfig / KUBERNETES_DISABLE_AUTOCONFIG | Disabilita la configurazione automatica | false |
kubernetes.master / KUBERNETES_MASTER | URL del master Kubernetes | https://kubernetes.default.svc |
kubernetes.api.version / KUBERNETES_API_VERSION | Versione dell'API | v1 |
openshift.url / OPENSHIFT_URL | URL del master OpenShift | Valore dell'URL del master Kubernetes |
kubernetes.oapi.version / KUBERNETES_OAPI_VERSION | Versione dell'API OpenShift | v1 |
kubernetes.trust.certificates / KUBERNETES_TRUST_CERTIFICATES | Considera attendibili tutti i certificati | false |
kubernetes.disable.hostname.verification / KUBERNETES_DISABLE_HOSTNAME_VERIFICATION | false | |
kubernetes.certs.ca.file / KUBERNETES_CERTS_CA_FILE | ||
kubernetes.certs.ca.data / KUBERNETES_CERTS_CA_DATA | ||
kubernetes.certs.client.file / KUBERNETES_CERTS_CLIENT_FILE | ||
kubernetes.certs.client.data / KUBERNETES_CERTS_CLIENT_DATA | ||
kubernetes.certs.client.key.file / KUBERNETES_CERTS_CLIENT_KEY_FILE | ||
kubernetes.certs.client.key.data / KUBERNETES_CERTS_CLIENT_KEY_DATA | ||
kubernetes.certs.client.key.algo / KUBERNETES_CERTS_CLIENT_KEY_ALGO | Algoritmo di crittografia della chiave client | RSA |
kubernetes.certs.client.key.passphrase / KUBERNETES_CERTS_CLIENT_KEY_PASSPHRASE | ||
kubernetes.auth.basic.username / KUBERNETES_AUTH_BASIC_USERNAME | ||
kubernetes.auth.basic.password / KUBERNETES_AUTH_BASIC_PASSWORD | ||
kubernetes.auth.tryKubeConfig / KUBERNETES_AUTH_TRYKUBECONFIG | Configura il client usando la configurazione Kubernetes | true |
kubeconfig / KUBECONFIG | Nome del file di configurazione Kubernetes da leggere | ~/.kube/config |
kubernetes.auth.tryServiceAccount / KUBERNETES_AUTH_TRYSERVICEACCOUNT | Configura il client dall'account di servizio | true |
kubernetes.tryNamespacePath / KUBERNETES_TRYNAMESPACEPATH | Configura il namespace del client dal percorso del namespace dell'account di servizio Kubernetes | true |
kubernetes.auth.token / KUBERNETES_AUTH_TOKEN | ||
kubernetes.watch.reconnectInterval / KUBERNETES_WATCH_RECONNECTINTERVAL | Intervallo di riconnessione del watch in ms | 1000 |
kubernetes.watch.reconnectLimit / KUBERNETES_WATCH_RECONNECTLIMIT | Numero di tentativi di riconnessione (-1 per infinito) | -1 |
kubernetes.connection.timeout / KUBERNETES_CONNECTION_TIMEOUT | Timeout di connessione in ms (0 per nessun timeout) | 10000 |
kubernetes.request.timeout / KUBERNETES_REQUEST_TIMEOUT | Timeout di lettura in ms | 10000 |
kubernetes.rolling.timeout / KUBERNETES_ROLLING_TIMEOUT | Timeout rolling in ms | 900000 |
kubernetes.logging.interval / KUBERNETES_LOGGING_INTERVAL | Intervallo di logging in ms | 20000 |
kubernetes.scale.timeout / KUBERNETES_SCALE_TIMEOUT | Timeout di scalatura in ms | 600000 |
kubernetes.websocket.timeout / KUBERNETES_WEBSOCKET_TIMEOUT | Timeout websocket in ms | 5000 |
kubernetes.websocket.ping.interval / kubernetes_websocket_ping_interval | Intervallo di ping websocket in ms | 30000 |
kubernetes.max.concurrent.requests / KUBERNETES_MAX_CONCURRENT_REQUESTS | 64 | |
kubernetes.max.concurrent.requests.per.host / KUBERNETES_MAX_CONCURRENT_REQUESTS_PER_HOST | 5 | |
kubernetes.impersonate.username / KUBERNETES_IMPERSONATE_USERNAME | Valore dell'header HTTP Impersonate-User | |
kubernetes.impersonate.group / KUBERNETES_IMPERSONATE_GROUP | Valore dell'header HTTP Impersonate-Group | |
kubernetes.tls.versions / KUBERNETES_TLS_VERSIONS | Versioni TLS separate da , | TLSv1.2 |
kubernetes.truststore.file / KUBERNETES_TRUSTSTORE_FILE | ||
kubernetes.truststore.passphrase / KUBERNETES_TRUSTSTORE_PASSPHRASE | ||
kubernetes.keystore.file / KUBERNETES_KEYSTORE_FILE | ||
kubernetes.keystore.passphrase / KUBERNETES_KEYSTORE_PASSPHRASE |
| K8s 1.19.1 | K8s 1.18.0 | K8s 1.17.0 | K8s 1.16.0 | K8s 1.15.3 | K8s 1.14.2 | K8s 1.12.0 | K8s 1.11.0 | K8s 1.10.0 | K8s 1.9.0 | K8s 1.7.0 | K8s 1.6.0 | K8s 1.4.9 |
|---|
| kubernetes-client 5.0.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 5.0.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 5.0.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.13.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.13.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.13.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.12.0 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.11.1 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.11.0 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.10.3 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.10.2 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.10.1 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.10.0 | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.9.2 | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.9.1 | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.9.0 | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.8.0 | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.7.1 | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.7.0 | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.6.4 | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.6.3 | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.6.2 | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.6.1 | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.6.0 | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.5.2 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.5.1 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.5.0 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.4.2 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.4.1 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.4.0 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.3.1 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.3.0 | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.2.2 | - | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.2.1 | - | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.2.0 | - | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.1.3 | - | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.1.2 | - | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.1.1 | - | - | - | - | - | - | ✓ | ✓ | ✓ | ✓ | - | - | - |
| kubernetes-client 4.1.0 | - | - | - | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
| kubernetes-client 4.0.0 | - | - | - | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
| kubernetes-client 3.2.0 | - | - | - | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
| kubernetes-client 3.1.12 | - | - | - | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
| kubernetes-client 3.0.11 | - | - | - | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
| kubernetes-client 3.0.10 | - | - | - | - | - | - | - | - | - | ✓ | ✓ | ✓ | - |
| kubernetes-client 3.0.3 | - | - | - | - | - | - | - | - | - | - | ✓ | - | - |
| kubernetes-client 1.3.92 | - | - | - | - | - | - | - | - | - | - | - | + | + |
| OCP 4.5.14 | OCP 4.2.0 | OCP 4.1.0 | OCP 3.11.0 | OCP 3.10.0 | OCP 3.9.0 | OCP 3.7.0 | OCP 3.6.0 |
|---|
| openshift-client 5.0.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 5.0.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 5.0.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.13.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.13.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.13.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.12.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.11.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.11.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.10.3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.10.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.10.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.10.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.9.2 | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.9.1 | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.9.0 | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.8.0 | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.7.1 | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.7.0 | - | ✓ | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.6.4 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.6.3 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.6.2 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.6.1 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.6.0 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.5.2 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.5.1 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.5.0 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.4.2 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.4.1 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.4.0 | - | - | ✓ | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.3.1 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.3.0 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.2.2 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.2.1 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.2.0 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.1.3 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.1.2 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.1.1 | - | - | - | ✓ | ✓ | ✓ | - | - |
| openshift-client 4.1.0 | - | - | - | - | ✓ | ✓ | ✓ | - |
| openshift-client 4.0.0 | - | - | - | - | - | ✓ | ✓ | ✓ |
| openshift-client 3.2.0 | - | - | - | - | - | ✓ | ✓ | ✓ |
| openshift-client 3.1.12 | - | - | - | - | - | ✓ | ✓ | ✓ |
| openshift-client 3.0.11 | - | - | - | - | - | ✓ | ✓ | ✓ |
| openshift-client 3.0.10 | - | - | - | - | - | ✓ | ✓ | ✓ |
| openshift-client 3.0.3 | - | - | - | - | - | - | ✓ | - |
| openshift-client 1.3.92 | - | - | - | - | - | - | - | + |
extensionsextensions| kubectl | Fabric8 Kubernetes Client |
|---|
kubectl config view | ConfigViewEquivalent.java |
kubectl config get-contexts | ConfigGetContextsEquivalent.java |
kubectl config current-context | ConfigGetCurrentContextEquivalent.java |
kubectl config use-context minikube | ConfigUseContext.java |
kubectl config view -o jsonpath='{.users[*].name}' | ConfigGetCurrentContextEquivalent.java |
kubectl get pods --all-namespaces | PodListGlobalEquivalent.java |
kubectl get pods | PodListEquivalent.java |
kubectl get pods -w | PodWatchEquivalent.java |
kubectl get pods --sort-by='.metadata.creationTimestamp' | PodListGlobalEquivalent.java |
kubectl run | PodRunEquivalent.java |
kubectl create -f test-pod.yaml | PodCreateYamlEquivalent.java |
kubectl exec my-pod -- ls / | PodExecEquivalent.java |
kubectl delete pod my-pod | PodDelete.java |
kubectl delete -f test-pod.yaml | PodDeleteViaYaml.java |
kubectl cp /foo_dir my-pod:/bar_dir | UploadDirectoryToPod.java |
kubectl cp my-pod:/tmp/foo /tmp/bar | DownloadFileFromPod.java |
kubectl cp my-pod:/tmp/foo -c c1 /tmp/bar | DownloadFileFromMultiContainerPod.java |
kubectl cp /foo_dir my-pod:/tmp/bar_dir | UploadFileToPod.java |
kubectl logs pod/my-pod | PodLogsEquivalent.java |
kubectl logs pod/my-pod -f | PodLogsFollowEquivalent.java |
kubectl logs pod/my-pod -c c1 | PodLogsMultiContainerEquivalent.java |
kubectl port-forward my-pod 8080:80 | PortForwardEquivalent.java |
kubectl get pods --selector=version=v1 -o jsonpath='{.items[*].metadata.name}' | PodListFilterByLabel.java |
kubectl get pods --field-selector=status.phase=Running | PodListFilterFieldSelector.java |
kubectl get pods --show-labels | PodShowLabels.java |
kubectl label pods my-pod new-label=awesome | PodAddLabel.java |
kubectl annotate pods my-pod icon-url=http://goo.gl/XXBTWq | PodAddAnnotation.java |
kubectl get configmap cm1 -o jsonpath='{.data.database}' | ConfigMapJsonPathEquivalent.java |
kubectl create -f test-svc.yaml | LoadAndCreateService.java |
kubectl create -f test-deploy.yaml | LoadAndCreateDeployment.java |
kubectl set image deploy/d1 nginx=nginx:v2 | RolloutSetImageEquivalent.java |
kubectl scale --replicas=4 deploy/nginx-deployment | ScaleEquivalent.java |
kubectl rollout restart deploy/d1 | RolloutRestartEquivalent.java |
kubectl rollout pause deploy/d1 | RolloutPauseEquivalent.java |
kubectl rollout resume deploy/d1 | RolloutResumeEquivalent.java |
kubectl rollout undo deploy/d1 | RolloutUndoEquivalent.java |
kubectl create -f test-crd.yaml | LoadAndCreateCustomResourceDefinition.java |
kubectl create -f customresource.yaml | CustomResourceCreateDemo.java |
kubectl create -f customresource.yaml | CustomResourceCreateDemoTypeless.java |
kubectl get ns | NamespaceListEquivalent.java |
kubectl apply -f test-resource-list.yml | CreateOrReplaceResourceList.java |
kubectl get events | EventsGetEquivalent.java |
kubectl top nodes | TopEquivalent.java |
kubectl auth can-i create deployment.apps | CanIEquivalent.java |