Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
kubernetes-client__java_CVE-2020-8570_client-java-parent-9_0_2_fixed — Java 客户端库,用于与 Kubernetes API 交互,支持以编程方式管理集群、Pod、部署及其他资源,并提供身份验证、Watch、Exec 和端口转发操作。 | Kitploit
工具/GitHubGitHub/shoucheng3/kubernetes-client__java_cve-2020-8570_client-java-parent-9_0_2_fixed
身份验证与授权云基础设施安全通用工具容器安全云安全API 安全
GitHubshoucheng3/kubernetes-client__java_cve-2020-8570_client-java-parent-9_0_2_fixed

kubernetes-client__java_CVE-2020-8570_client-java-parent-9_0_2_fixed

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

Java 客户端库,用于与 Kubernetes API 交互,支持以编程方式管理集群、Pod、部署及其他资源,并提供身份验证、Watch、Exec 和端口转发操作。

查看仓库
2110个月前尚未审核

Kubernetes Java 客户端

Build Status Client Capabilities Client Support Level

用于 kubernetes API 的 Java 客户端。

客户端版本管理

Java 客户端采用 Semantic Versioning(语义化版本控制)。每当为新的 Kubernetes 版本重新生成客户端时,我们会递增主版本号(见下表)。每次这样做都会新增 API,并且生成的 Kubernetes API 存根中可能包含破坏性变更。升级主版本时,请做好应对潜在破坏性变更的准备。

安装

要将 Java 客户端库安装到本地 Maven 仓库,只需执行:

git clone --recursive https://github.com/kubernetes-client/java
cd java
mvn install

更多信息请参考 官方文档。

Maven 用户

将此依赖添加到项目的 POM 文件中:

<dependency>
    <groupId>io.kubernetes</groupId>
    <artifactId>client-java</artifactId>
    <version>8.0.2</version>
</dependency>

Gradle 用户

compile 'io.kubernetes:client-java:8.0.2'

其他

首先执行以下命令生成 JAR 文件:

git clone --recursive https://github.com/kubernetes-client/java
cd java/kubernetes
mvn package

然后手动安装以下 JAR 文件:

  • target/client-java-api-8.0.3-SNAPSHOT.jar
  • target/lib/*.jar

示例

我们为常见用例准备了几个示例,如下所示:

  • 配置:
    • InClusterClientExample: 在 Kubernetes 集群内部运行时配置客户端。
    • KubeConfigFileClientExample: 从外部配置客户端以访问 Kubernetes 集群。
  • 基础:
    • SimpleExample: 使用客户端的最小简单示例。
    • ProtoExample: 使用 protobuf 序列化协议请求/接收负载。
    • (5.0.0+) PatchExample: 以多种支持的补丁格式修补资源对象,等同于 kubectl patch。
    • FluentExample: 使用流畅构建器风格构造任意资源。
    • YamlExample: 推荐以 YAML 格式加载或转储资源的方式。
  • 流式:
    • WatchExample: 订阅特定资源的 watch 事件,等同于 kubectl get <resource> -w。
    • LogsExample: 从运行中的容器获取日志,等同于 kubectl logs。
    • ExecExample: 与运行中的容器建立 "exec" 会话,等同于 kubectl exec。
    • PortForwardExample: 将本地端口映射到 Pod 上的端口,等同于 kubectl port-forward。
    • AttachExample: 连接到已在容器内运行的进程,等同于 kubectl attach。
    • CopyExample: 向容器复制文件和目录或从容器复制出来,等同于 kubectl cp。
    • WebSocketsExample: 与特定资源建立任意 WebSocket 会话。
  • 高级: (注意:以下示例需要 client-java-extended 模块)
    • (5.0.0+) InformerExample: 构建一个 list-watch 资源并将通知反映到本地缓存的 informer。
    • (5.0.0+) PagerExample: 支持分页(仅限 list 请求),以减轻服务端负载/网络拥塞。
    • (6.0.0+) ControllerExample: 通过 list-watch 一个或多个资源来构建协调世界状态的控制器。
    • (6.0.0+) LeaderElectionExample: 用于实现高可用控制器的领导者选举工具。
    • (9.0.0+) SpringIntegrationControllerExample: 基于 Spring 框架的依赖注入构建 Kubernetes 控制器。
    • (9.0.0+) GenericKubernetesClientExample: 为任何 Kubernetes 类型(包括 CRD)构建通用客户端接口。

列出所有 Pod:

import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1Pod;
import io.kubernetes.client.openapi.models.V1PodList;
import io.kubernetes.client.util.Config;

import java.io.IOException;

public class Example {
    public static void main(String[] args) throws IOException, ApiException{
        ApiClient client = Config.defaultClient();
        Configuration.setDefaultApiClient(client);

        CoreV1Api api = new CoreV1Api();
        V1PodList list = api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null);
        for (V1Pod item : list.getItems()) {
            System.out.println(item.getMetadata().getName());
        }
    }
}

监视命名空间对象:

import com.google.gson.reflect.TypeToken;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1Namespace;
import io.kubernetes.client.util.Config;
import io.kubernetes.client.util.Watch;

import java.io.IOException;

public class WatchExample {
    public static void main(String[] args) throws IOException, ApiException{
        ApiClient client = Config.defaultClient();
        Configuration.setDefaultApiClient(client);

        CoreV1Api api = new CoreV1Api();

        Watch<V1Namespace> watch = Watch.createWatch(
                client,
                api.listNamespaceCall(null, null, null, null, null, 5, null, null, Boolean.TRUE, null, null),
                new TypeToken<Watch.Response<V1Namespace>>(){}.getType());

        for (Watch.Response<V1Namespace> item : watch) {
            System.out.printf("%s : %s%n", item.type, item.object.getMetadata().getName());
        }
    }
}
下载工具