This client provides access to the full Kubernetes & OpenShift REST APIs via a fluent DSL.
| Module | Maven Central | Javadoc |
|---|---|---|
| kubernetes-client | ||
| openshift-client |
| Extensions | Maven Central | Javadoc |
|---|---|---|
| knative-client | ||
| tekton-client | ||
| chaosmesh-client | ||
| volumesnapshot-client | ||
| volcano-client | ||
| istio-client | ||
| open-cluster-management-client |
The easiest way to create a client is:
KubernetesClient client = new KubernetesClientBuilder().build();
DefaultOpenShiftClient implements both the KubernetesClient & OpenShiftClient interface so if you need the
OpenShift extensions, such as Builds, etc then simply do:
OpenShiftClient osClient = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class);
This will use settings from different sources in the following order of priority:
System properties are preferred over environment variables. The following system properties & environment variables can be used for configuration:
| Property / Environment Variable | Description | Default value |
|---|---|---|
kubernetes.disable.autoConfig / KUBERNETES_DISABLE_AUTOCONFIG |
Disable automatic configuration (KubernetesClient would not look in ~/.kube/config, mounted ServiceAccount, environment variables or System properties for Kubernetes cluster information) |
false |
kubernetes.master / KUBERNETES_MASTER |
Kubernetes master URL | https://kubernetes.default.svc |
kubernetes.api.version / KUBERNETES_API_VERSION |
API version | v1 |
openshift.url / OPENSHIFT_URL |
OpenShift master URL | Kubernetes master URL value |
kubernetes.oapi.version / KUBERNETES_OAPI_VERSION |
OpenShift API version | v1 |
kubernetes.trust.certificates / KUBERNETES_TRUST_CERTIFICATES |
Trust all certificates | 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 |
Client key encryption algorithm | 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.serviceAccount.token / KUBERNETES_AUTH_SERVICEACCOUNT_TOKEN |
Name of the service account token file | /var/run/secrets/kubernetes.io/serviceaccount/token |
kubernetes.auth.tryKubeConfig / KUBERNETES_AUTH_TRYKUBECONFIG |
Configure client using Kubernetes config | true |
kubeconfig / KUBECONFIG |
Name of the kubernetes config file to read | ~/.kube/config |
kubernetes.auth.tryServiceAccount / KUBERNETES_AUTH_TRYSERVICEACCOUNT |
Configure client from Service account | true |
$ claude mcp add kubernetes-client \
-- python -m otcore.mcp_server <graph>