kubernetes 如何立即删除pod?

gzszwxb4  于 2023-04-29  发布在  Kubernetes
关注(0)|答案(1)|浏览(262)

我想使用io.kubernetes:ClientJavaApi立即强制删除pod
我尝试使用以下命令进行删除,但仍有延迟

options = new V1DeleteOptions();
options.setGracePeriodSeconds(0L);
options.setPropagationPolicy("Foreground");
options.setOrphanDependents(false);

V1Pod result = coreV1Api.deleteNamespacedPod(name, namespace, "true", null,
                    gracePeriodSeconds, null, null, options);
cpjpxq1n

cpjpxq1n1#

这个应该能用

V1DeleteOptions v1DeleteOptions = new V1DeleteOptions();
v1DeleteOptions.setGracePeriodSeconds(0L);
V1Pod deleteNamespacedPod = coreV1Api.deleteNamespacedPod(
        podName,
        namespace,
        null,
        "false",
        0,
        true,
        null,
        v1DeleteOptions);

相关问题