
Cliente Java que fornece acesso fluente via DSL às APIs REST do Kubernetes e OpenShift para gerenciar infraestrutura nativa em nuvem, pods, serviços e configurações com suporte a autenticação e TLS.
Este cliente fornece acesso completo às Kubernetes e OpenShift REST APIs através de uma DSL fluente.
A maneira mais fácil de criar um cliente é:```java KubernetesClient client = new DefaultKubernetesClient();
`DefaultOpenShiftClient` implementa tanto a interface `KubernetesClient` quanto a `OpenShiftClient`, então se você precisar das extensões do OpenShift, como `Build`s, etc, basta fazer:```java
OpenShiftClient osClient = new DefaultOpenShiftClient();
Isso usará configurações de diferentes fontes na seguinte ordem de prioridade:
As propriedades do sistema têm preferência sobre as variáveis de ambiente. As seguintes propriedades do sistema e variáveis de ambiente podem ser usadas para configuração:
Alternativamente, você pode usar o ConfigBuilder para criar um objeto de configuração para o cliente Kubernetes:```java
Config config = new ConfigBuilder().withMasterUrl("https://mymaster.com").build();
KubernetesClient client = new DefaultKubernetesClient(config);
Usar o DSL é o mesmo para todos os recursos.
Listar recursos:```java
NamespaceList myNs = client.namespaces().list();
ServiceList myServices = client.services().list();
ServiceList myNsServices = client.services().inNamespace("default").list();
Obter um recurso:```java Namespace myns = client.namespaces().withName("myns").get();
Service myservice = client.services().inNamespace("default").withName("myservice").get();
Excluir:```java
Namespace myns = client.namespaces().withName("myns").delete();
Service myservice = client.services().inNamespace("default").withName("myservice").delete();
A edição de recursos usa os inline builders do 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());
No mesmo espírito, você pode embutir builders para criar:```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());
Você também pode definir o apiVersion do recurso como no caso de SecurityContextConstraints :```java SecurityContextConstraints scc = new SecurityContextConstraintsBuilder() .withApiVersion("v1") .withNewMetadata().withName("scc").endMetadata() .withAllowPrivilegedContainer(true) .withNewRunAsUser() .withType("RunAsAny") .endRunAsUser() .build();
### Acompanhando eventos
Use `io.fabric8.kubernetes.api.model.Event` como T para 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);
}
});
A API do kubernetes define uma série de extensões como daemonSets, jobs, ingresses e assim por diante, que são todos utilizáveis no DSL extensions():
ex.: para listar os jobs...``` jobs = client.batch().jobs().list();
### Carregando recursos de fontes externas
Há casos em que você deseja ler um recurso de uma fonte externa, em vez de defini-lo usando o DSL do cliente.
Para esses casos, o cliente permite que você carregue o recurso a partir de:
- Um arquivo *(Suporta tanto java.io.File quanto java.lang.String)*
- Uma url
- Um input stream
Uma vez que o recurso é carregado, você pode tratá-lo como faria se o tivesse criado você mesmo.
Por exemplo, vamos ler um pod de um arquivo yml e trabalhar com ele:
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);
### Passando uma referência de um recurso para o cliente
No mesmo espírito, você pode usar um objeto criado externamente (seja uma referência ou usando sua representação em string).
Por exemplo:
Pod pod = someThirdPartyCodeThatCreatesAPod();
Boolean deleted = client.resource(pod).delete();
### Adaptando o cliente
O cliente suporta adaptadores plugáveis. Um exemplo de adaptador é o [OpenShift Adapter](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/master/openshift-client/src/main/java/io/fabric8/openshift/client/OpenShiftExtensionAdapter.java)
que permite adaptar uma instância existente de [KubernetesClient](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/KubernetesClient.java) para um [OpenShiftClient](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/master/openshift-client/src/main/java/io/fabric8/openshift/client/OpenShiftClient.java).
Por exemplo:```java
KubernetesClient client = new DefaultKubernetesClient();
OpenShiftClient oClient = client.adapt(OpenShiftClient.class);
O cliente também suporta o método isAdaptable() que verifica se a adaptação é possível e retorna true se for.```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."); }
#### Adaptação e encerramento
Observe que ao usar `adapt()` tanto o adaptee quanto o target compartilharão os mesmos recursos (cliente http subjacente, pools de threads etc). Isso significa que `close()` não precisa ser usado em todas as instâncias criadas via `adapt`. Chamar `close()` em qualquer uma das instâncias gerenciadas por `adapt()` ou na instância original limpará adequadamente todos os recursos e, portanto, nenhuma das instâncias será mais utilizável.
## Simulação do Kubernetes
Juntamente com o cliente, este projeto também fornece um servidor mock do Kubernetes que você pode usar para fins de teste.
O servidor mock é baseado em `https://github.com/square/okhttp/tree/master/mockwebserver`, mas é capacitado pelo DSL e recursos fornecidos por `https://github.com/fabric8io/mockwebserver`.
O Mock Web Server possui dois modos de operação:
- Modo de expectativas
- Modo CRUD
### Modo de expectativas
É o modo típico onde você primeiro define quais são as requisições http esperadas e quais devem ser as respostas para cada requisição.
Mais detalhes sobre o uso podem ser encontrados em: https://github.com/fabric8io/mockwebserver
Este modo tem sido amplamente utilizado para testar o próprio cliente. Certifique-se de verificar [kubernetes-test](https://github.com/shoucheng3/fabric8io__kubernetes-client_cve-2021-4178_5-0-2/blob/master/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock).
Para adicionar um servidor Kubernetes ao seu teste:```java
@Rule
public KubernetesServer server = new KubernetesServer();
Definir cada requisição e resposta individualmente pode se tornar tedioso. Dado que na maioria dos casos o servidor web mock é usado para realizar operações simples baseadas em CRUD, um modo CRUD foi adicionado. Ao usar o modo CRUD, o servidor web mock armazenará, lerá, atualizará e excluirá recursos do Kubernetes usando um mapa em memória e aparecerá como um servidor API real.
Para adicionar um Servidor Kubernetes no modo CRUD ao seu teste:```java @Rule public KubernetesServer server = new KubernetesServer(true, true);
Então você pode usar o servidor assim:```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));
}
Você pode usar o mecanismo de simulação (mocking) do KubernetesClient com JUnit5. Como ele não suporta @Rule e @ClassRule, existe uma anotação dedicada @EnableKubernetesMockClient.
Se você deseja criar uma instância do KubernetesClient simulado para cada teste (JUnit4 @Rule), você precisa declarar a instância de KubernetesClient conforme mostrado abaixo.```java
@EnableKubernetesMockClient
class ExampleTest {
KubernetesClient client;
@Test
public void testInStandardMode() {
...
}
}
Caso você queira definir uma instância estática do servidor simulado para todos os testes (JUnit4 `@ClassRule`), você precisa declarar a instância de `KubernetesClient` conforme mostrado abaixo. Você também pode ativar o crudMode usando o campo de anotação `crud`.```java
@EnableKubernetesMockClient(crud = true)
class ExampleTest {
static KubernetesClient client;
@Test
public void testInCrudMode() {
...
}
}
Nota: Esta matriz foi preparada executando nossos testes de integração em diferentes versões do OpenShift.
Todos os objetos de recurso usados aqui serão de acordo com OpenShift 3.9.0 e Kubernetes 1.9.0. Todos os objetos de recurso fornecerão todos os campos de acordo com OpenShift 3.9.0 e Kubernetes 1.9.0
batch quanto em extensions (Extensions está obsoleto)apps quanto em extensions (Extensions está obsoleto)apps quanto em extensions (Extensions está obsoleto)apps quanto em extensions (Extensions está obsoleto)network quanto em extensions (Extensions está obsoleto)client base DSL para storage DSLclient base DSL e para apenas Extensions:
Frameworks/Bibliotecas/Ferramentas:
Plugins de CI:
Ferramentas de Build:
Plataformas:
Plataformas Proprietárias:
À medida que nossa comunidade cresce, gostaríamos de manter o rastreamento de nossos usuários. Por favor, envie um PR com o nome da sua organização/comunidade.
Aqui estão os links do Github Actions e do Jenkins para os testes que são executados para cada novo Pull Request. Você também pode visualizar todas as compilações recentes.
Para receber atualizações sobre os lançamentos, você pode participar em https://groups.google.com/forum/embed/?place=forum/fabric8-devclients## Kubectl Java Equivalents
Esta tabela fornece mapeamentos do kubectl para o Kubernetes Java Client. A maioria dos mapeamentos é bastante direta e são operações de uma linha. No entanto, alguns podem exigir um pouco mais de código para alcançar o mesmo resultado:
| Propriedade / Variável de Ambiente | Descrição | Valor padrão |
|---|
kubernetes.disable.autoConfig / KUBERNETES_DISABLE_AUTOCONFIG | Desativar configuração automática | false |
kubernetes.master / KUBERNETES_MASTER | URL do mestre Kubernetes | https://kubernetes.default.svc |
kubernetes.api.version / KUBERNETES_API_VERSION | Versão da API | v1 |
openshift.url / OPENSHIFT_URL | URL do mestre OpenShift | Valor da URL do mestre Kubernetes |
kubernetes.oapi.version / KUBERNETES_OAPI_VERSION | Versão da API do OpenShift | v1 |
kubernetes.trust.certificates / KUBERNETES_TRUST_CERTIFICATES | Confiar em todos os certificados | 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 de criptografia da chave do cliente | 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 | Configurar cliente usando configuração do Kubernetes | true |
kubeconfig / KUBECONFIG | Nome do arquivo de configuração do Kubernetes a ser lido | ~/.kube/config |
kubernetes.auth.tryServiceAccount / KUBERNETES_AUTH_TRYSERVICEACCOUNT | Configurar cliente a partir da conta de serviço | true |
kubernetes.tryNamespacePath / KUBERNETES_TRYNAMESPACEPATH | Configurar namespace do cliente a partir do caminho do namespace da conta de serviço do Kubernetes | true |
kubernetes.auth.token / KUBERNETES_AUTH_TOKEN | ||
kubernetes.watch.reconnectInterval / KUBERNETES_WATCH_RECONNECTINTERVAL | Intervalo de reconexão do watch em ms | 1000 |
kubernetes.watch.reconnectLimit / KUBERNETES_WATCH_RECONNECTLIMIT | Número de tentativas de reconexão (-1 para infinito) | -1 |
kubernetes.connection.timeout / KUBERNETES_CONNECTION_TIMEOUT | Tempo limite de conexão em ms (0 para sem limite) | 10000 |
kubernetes.request.timeout / KUBERNETES_REQUEST_TIMEOUT | Tempo limite de leitura em ms | 10000 |
kubernetes.rolling.timeout / KUBERNETES_ROLLING_TIMEOUT | Tempo limite de rolling em ms | 900000 |
kubernetes.logging.interval / KUBERNETES_LOGGING_INTERVAL | Intervalo de logging em ms | 20000 |
kubernetes.scale.timeout / KUBERNETES_SCALE_TIMEOUT | Tempo limite de escala em ms | 600000 |
kubernetes.websocket.timeout / KUBERNETES_WEBSOCKET_TIMEOUT | Tempo limite do websocket em ms | 5000 |
kubernetes.websocket.ping.interval / kubernetes_websocket_ping_interval | Intervalo de ping do websocket em 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 | Valor do cabeçalho HTTP Impersonate-User | |
kubernetes.impersonate.group / KUBERNETES_IMPERSONATE_GROUP | Valor do cabeçalho HTTP Impersonate-Group | |
kubernetes.tls.versions / KUBERNETES_TLS_VERSIONS | Versões TLS separadas por , | 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 |