-
大小: 5.09MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-11-14
- 语言: 其他
- 标签:
资源简介
kubernetes-in-action书籍的各个章节的代码示例,防止手敲产生错误,直接打开对应章节复制代码即可。
代码片段和文件信息
package kubia;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.PodList;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClient;
import java.util.Arrays;
public class Fabric8ClientTest {
public static void main(String[] args) throws Exception {
KubernetesClient client = new DefaultKubernetesClient();
// list pods in the default namespace
PodList pods = client.pods().inNamespace(“default“).list();
pods.getItems().stream().forEach(s -> System.out.println(“Found pod: “ + s.getmetadata().getName()));
// create a pod
System.out.println(“Creating a pod“);
Pod pod = client.pods().inNamespace(“default“).createNew()
.withNewmetadata()
.withName(“my-programmatically-created-pod“)
.endmetadata()
.withNewSpec()
.addNewContainer()
.withName(“main“)
.withImage(“busybox“)
.withCommand(Arrays.asList(“sleep“ “99999“))
.endContainer()
.endSpec()
.done();
System.out.println(“Created pod: “ + pod);
// edit the pod (add a label to it)
client.pods().inNamespace(“default“).withName(“my-programmatically-created-pod“).edit()
.editmetadata()
.addToLabels(“foo“ “bar“)
.endmetadata()
.done();
System.out.println(“Added label foo=bar to pod“);
System.out.println(“Waiting 1 minute before deleting pod...“);
Thread.sleep(60000);
// delete the pod
client.pods().inNamespace(“default“).withName(“my-programmatically-created-pod“).delete();
System.out.println(“Deleted the pod“);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5266102 2019-05-23 15:49 openssl-1.0.2g.tar.gz
目录 0 2019-01-10 14:45 kubernetes-in-action-master\
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter02\
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter02\kubia\
文件 62 2019-01-10 14:45 kubernetes-in-action-master\Chapter02\kubia\Dockerfile
文件 361 2019-01-10 14:45 kubernetes-in-action-master\Chapter02\kubia\app.js
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter03\
文件 66 2019-01-10 14:45 kubernetes-in-action-master\Chapter03\custom-namespace.yaml
文件 144 2019-01-10 14:45 kubernetes-in-action-master\Chapter03\kubia-gpu.yaml
文件 202 2019-01-10 14:45 kubernetes-in-action-master\Chapter03\kubia-manual-custom-namespace.yaml
文件 227 2019-01-10 14:45 kubernetes-in-action-master\Chapter03\kubia-manual-with-labels.yaml
文件 172 2019-01-10 14:45 kubernetes-in-action-master\Chapter03\kubia-manual.yaml
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\
文件 239 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\batch-job.yaml
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\batch-job\
文件 107 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\batch-job\Dockerfile
文件 371 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\cronjob.yaml
文件 227 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-liveness-probe-initial-delay.yaml
文件 197 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-liveness-probe.yaml
文件 293 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-rc.yaml
文件 325 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-replicaset-matchex
文件 266 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-replicaset.yaml
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-unhealthy\
文件 62 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-unhealthy\Dockerfile
文件 527 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\kubia-unhealthy\app.js
文件 273 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\multi-completion-batch-job.yaml
文件 290 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\multi-completion-parallel-batch-job.yaml
文件 313 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\ssd-monitor-daemonset.yaml
目录 0 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\ssd-monitor\
文件 69 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\ssd-monitor\Dockerfile
文件 280 2019-01-10 14:45 kubernetes-in-action-master\Chapter04\time-limited-batch-job.yaml
............此处省略200个文件信息
- 上一篇:struts2实现用户登录注册
- 下一篇:stm32f334BUCK,逆变程序
评论
共有 条评论