zl程序教程

您现在的位置是:首页 >  后端

当前栏目

k8s中yaml语法格式

k8s 格式 语法 yaml
2023-09-27 14:25:58 时间
yaml语法总结

Map 是字典,就是⼀个 key:value 的键值对

Lists 就是列表,说⽩了就是数组

1、image
 containers: 

 image: cnych/liveness
2、selector

selector:

 matchLabels:

 app: mynginx-test
3、containers []Object
spec:

 containers:

 - name: nginx-pod

 image: "nginx"

 - name: content

 image: "alpine"
4、initialDelaySeconds
 livenessProbe:

 exec:

 command:

 - cat

 - /tmp/healthy

 initialDelaySeconds: 5
5、matchLabels map[string]string
 selector:

 matchLabels:

 app: mynginx-test

 app: v1
6、command []string
command:

 - cat

 - /tmp/healthy

shell 脚本实现 k8s 集群环境下指定 ns 资源的 yaml 文件备份 在基于 `k8s` 平台的容器化部署环境中,有时候需要快速的实现部署文件的迁移备份,当 `k8s` 平台部署一个 `app` 时,都会相应的产生一堆 `yaml` 文件,如果 `yaml` 文件数量较少,我们可以人工手动的方式进行拷贝,但是当 `yaml` 文件数量多,并且该 `k8s` 平台部署了多个 `app` 时,如果在采用...