Lower level Java REST client for Kubernetes API.
This project is still in an early stage, public API and classes are subject to changes.
Please try it out and share your opinion, but use at your own risk.
<dependencies>
<dependency>
<groupId>com.marcnuri.yakc</groupId>
<artifactId>kubernetes-api</artifactId>
<version>0.0.28</version>
</dependency>
<dependency>
<groupId>com.marcnuri.yakc</groupId>
<artifactId>kubernetes-client</artifactId>
<version>0.0.28</version>
</dependency>
</dependencies>
dependencies {
implementation 'com.marcnuri.yakc:kubernetes-api:0.0.28'
implementation 'com.marcnuri.yakc:kubernetes-client:0.0.28'
}
try (KubernetesClient kc = new KubernetesClient()) {
kc.create(CoreV1Api.class).listPodForAllNamespaces().stream().forEach(p ->
System.out.printf("%-15s %s%n", p.getMetadata().getNamespace(), p.getMetadata().getName())
);
}
Check the quickstarts directory for projects ready to use with illustrative examples on how to use the client.
- Quarkus Kubernetes Dashboard, full featured reactive Kubernetes dashboard built with Quarkus and ReactJS. See nested README.md for more information. You can also checkout a demo on YouTube.
- Pods contains a Maven project with examples to the diverse available API operations for Pod resources. See nested README.md for more information.
- Pod Logs contains a Maven project with an example showcasing how to retrieve Pod logs, both with follow and no-follow options. See nested README.md for more information.
- Pod Exec contains a Maven project with an example showcasing how to execute commands in a Pod container. See nested README.md for more information.
- Top for Nodes contains a Maven project with an example on how to query Nodes and Pod containers to calculate resource availability and usage. See nested README.md for more information.
- Custom Resource Definition contains a Maven project with a complete example on how to create Custom Resource Definitions and how to create and use an API to manipulate those custom resources. See nested README.md for more information.
- Access Cluster from Pod demonstrates how to access the underlying k8s cluster's REST API from within a Pod. See nested README.md for more information.
Check out the different Katacoda scenarios where you can try YAKC from your browser and without installing anything in your machine.
We'll be adding several scenarios with increasing complexity, as of now you can try out how to setup Maven to use YAKC.
Provides the basic interfaces and Exception types to be used across the different modules.
Kubernetes model objects to be used for REST API serialization/deserialization.
Model types are generated for Kubernetes equivalents in versions ranging from 1.15 to 1.25.
Retrofit API client Java interfaces for the latest Kubernetes JSON OpenAPI schema.
API methods for Kubernetes REST endpoints in versions ranging from 1.15 to 1.25.
Kubernetes Retrofit2 based Java client to be used with kubernetes-api or any of the provided apis.
Retrofit API client Java interfaces for Kubernetes cert-manager (1.0.4 - 1.5.3).
cert-manager provides support for x509 certificate management for Kubernetes. It's a Kubernetes add-on that automates the management and issuance of TLS certificates, making it very easy to provide certificates for developers working within your cluster.
The Java types provided by YAKC will further improve the developer experience by enabling developers to interact with cert-manager from Java.
Retrofit API client Java interfaces for Chaos Mesh (1.1.0 - 2.0.0).
Chaos Mesh is chaos engineering platform that orchestrates chaos on Kubernetes environments.
Retrofit API client Java interfaces for Dapr - Distributed Application Runtime (1.0.1 - 1.4.1).
Dapr is a portable, event-driven, runtime for building distributed applications across cloud and edge.
Retrofit API client Java interfaces for Istio (1.7 - 1.11.3).
Istio is a service-mesh for distributed applications. Istio leverages the required features to run a successful and efficient distributed microservice architecture by providing a uniform way to secure, monitor and connect microservices.
Retrofit API client Java interfaces for Knative (0.19.0 - 0.22.0).
Knative is a Kubernetes-based platform to manage and deploy serverless workloads.
Retrofit API client Java interfaces for KUDO (0.18.2 - 0.19.0).
Kubernetes Universal Declarative Operator (KUDO) provides a declarative approach to building production-grade Kubernetes Operators covering the entire application lifecycle.
Retrofit API client Java interfaces for Kubernetes Metrics Server (0.4.0).
Metrics server collects resource metrics from Pods and Nodes making them ready to be consumed via the Metrics API by Horizontal Pod Autoscaler and other scaling solutions.
YAKC provides the means to access the Metrics API from Java.
Retrofit API client Java interfaces for OpenShift (3.11 - 4.4).
This module contains models for OpenShift specific Kubernetes resources and the Retrofit APIs to access them.
This extension provides the requirements to be able to produce Quarkus native images for your application running with YAKC.
The extension is hosted in a separate repository.