新增说明及示例文件
This commit is contained in:
29
description/Configuration/ConfigMaps/description.yml
Normal file
29
description/Configuration/ConfigMaps/description.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
# ConfigMaps 说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/configuration/configmap
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: ConfigMap
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 ConfigMap 的名称
|
||||
## 命名空间
|
||||
namespace: 此 ConfigMap 所属命名空间
|
||||
# 数据( UTF-8 字节类型数据)
|
||||
data:
|
||||
## 直接定义属性(每一个键都映射到一个简单的值)
|
||||
key_name_1: 'key_value_1'
|
||||
key_name-2: key_value_2
|
||||
## 定义文件(每一个键都映射到一个文件)
|
||||
file_name_1.properties: |
|
||||
key.1.name=key.1.value
|
||||
key.2.name=key.2.value
|
||||
file_name_2.properties: |
|
||||
key.11.name=key.11.value
|
||||
key.12.name=key.12.value
|
||||
# 数据(二进制 base64 编码类型数据)
|
||||
binaryData:
|
||||
key_name_a: a2V5X3ZhbHVlX2E=
|
||||
key_name_b: a2V5X3ZhbHVlX2I=
|
||||
# 配置此 ConfigMaps 为不可变更(此 ConfigMaps 创建后,内容将不可变更,想要变更内容时,只能将此 ConfigMaps 删除后重建)
|
||||
immutable: true
|
||||
10
description/Configuration/ConfigMaps/example-halo.yml
Normal file
10
description/Configuration/ConfigMaps/example-halo.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: example-halo
|
||||
namespace: halo
|
||||
data:
|
||||
spring.sql.init.platform: mysql
|
||||
spring.r2dbc.url: r2dbc:pool:mysql://{HOST}:{PORT}/{DATABASE}
|
||||
halo.external-url: http://localhost:8090/
|
||||
immutable: true
|
||||
8
description/Configuration/ConfigMaps/example-mysql.yml
Normal file
8
description/Configuration/ConfigMaps/example-mysql.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: example-mysql
|
||||
namespace: mysql
|
||||
data:
|
||||
MYSQL_DATABASE: app
|
||||
immutable: true
|
||||
23
description/Configuration/Secret/description.yml
Normal file
23
description/Configuration/Secret/description.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
# Secret 说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/configuration/secret
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Secret
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Secret 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Secret 所属命名空间
|
||||
# 类型
|
||||
type: Opaque
|
||||
# 数据( UTF-8 字节类型)
|
||||
stringData:
|
||||
key_name_1: key_value_1
|
||||
key_name-2: key_value_2
|
||||
# 数据( base64 编码类型数据)
|
||||
data:
|
||||
key_name_a: a2V5X3ZhbHVlX2E=
|
||||
key_name_b: a2V5X3ZhbHVlX2I=
|
||||
# 配置此 Secret 为不可变更(此 Secret 创建后,内容将不可变更,想要变更内容时,只能将此 Secret 删除后重建)
|
||||
immutable: true
|
||||
12
description/Configuration/Secret/example-halo.yml
Normal file
12
description/Configuration/Secret/example-halo.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: example-halo
|
||||
namespace: halo
|
||||
type: Opaque
|
||||
stringData:
|
||||
spring.r2dbc.username: halo
|
||||
spring.r2dbc.password: pKMoNmuCyxP6QZq7
|
||||
halo.security.initializer.superadminusername: admin
|
||||
halo.security.initializer.superadminpassword: QrgkqetX7LNz38hB
|
||||
immutable: true
|
||||
11
description/Configuration/Secret/example-mysql.yml
Normal file
11
description/Configuration/Secret/example-mysql.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: example-mysql
|
||||
namespace: mysql
|
||||
type: Opaque
|
||||
stringData:
|
||||
MYSQL_ROOT_PASSWORD: pKMoNmuCyxP6QZq7
|
||||
MYSQL_USER: app
|
||||
MYSQL_PASSWORD: QrgkqetX7LNz38hB
|
||||
immutable: true
|
||||
25
description/Service/Endpoints/description.yml
Normal file
25
description/Service/Endpoints/description.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
# Endpoint 说明,官方文档:
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Endpoints
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Endpoint 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Endpoint 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
subsets:
|
||||
## 端点1
|
||||
### 端点地址
|
||||
- addresses:
|
||||
#### 端点 IP
|
||||
- ip: 端点 IP
|
||||
### 端点端口号
|
||||
ports:
|
||||
- port: 端点端口号
|
||||
14
description/Service/Endpoints/example.yml
Normal file
14
description/Service/Endpoints/example.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: example-endpoints
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-endpoints
|
||||
app: demo
|
||||
type: endpoints
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: 192.0.2.42
|
||||
ports:
|
||||
- port: 9376
|
||||
60
description/Service/Ingress/description.yml
Normal file
60
description/Service/Ingress/description.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
# Ingress 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/services-networking/ingress
|
||||
# API 版本
|
||||
apiVersion: networking.k8s.io/v1
|
||||
# 资源类型
|
||||
kind: Ingress
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Ingress 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Ingress 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 注解(使用不同的控制器时注解不同,具体见官方文档)
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
# 内容
|
||||
spec:
|
||||
## TLS 证书
|
||||
tls:
|
||||
### TLS 证书1
|
||||
#### 该 TLS 证书对应的 HOST(需要和 rules 中配置的 host 保持一致)
|
||||
- hosts:
|
||||
- host1
|
||||
- host2
|
||||
#### 该 TLS 证书使用的 Secret 名称
|
||||
secretName: 该 TLS 证书使用的 Secret 名称
|
||||
## 规则
|
||||
rules:
|
||||
### 规则1
|
||||
#### HOST
|
||||
- host: HOST
|
||||
#### HTTP 规则
|
||||
http:
|
||||
##### 路径
|
||||
paths:
|
||||
###### 路径1
|
||||
####### 路径
|
||||
- path: 路径
|
||||
####### 路径类型【ImplementationSpecific:视 IngressClass 而定;Prefix:前缀匹配;Exact:精确匹配】
|
||||
pathType: 路径类型
|
||||
####### 后端
|
||||
backend:
|
||||
######## Service 类型(常用于后端服务,不能和 Resource 类型同时配置)
|
||||
service:
|
||||
######### Service 的名称
|
||||
name: Service 的名称
|
||||
######### Service 的端口号
|
||||
port:
|
||||
number: Service 的端口号
|
||||
######## Resource 类型(常用于前端静态资源服务,不能和 Service 类型同时配置)
|
||||
resource:
|
||||
#########
|
||||
apiGroup: k8s.example.com
|
||||
######### 资源类型
|
||||
kind: StorageBucket
|
||||
######### 资源名称
|
||||
name: icon-assets
|
||||
31
description/Service/Ingress/example-multi.yml
Normal file
31
description/Service/Ingress/example-multi.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: example-ingress-multi
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-ingress-multi
|
||||
app: ingress
|
||||
type: ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: "foo.bar.com"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/bar"
|
||||
backend:
|
||||
service:
|
||||
name: service1
|
||||
port:
|
||||
number: 80
|
||||
- host: "*.foo.com"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/foo"
|
||||
backend:
|
||||
service:
|
||||
name: service2
|
||||
port:
|
||||
number: 80
|
||||
22
description/Service/Ingress/example-single.yml
Normal file
22
description/Service/Ingress/example-single.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: example-ingress-single
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-ingress-single
|
||||
app: ingress
|
||||
type: ingress
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
spec:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /testpath
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: test
|
||||
port:
|
||||
number: 80
|
||||
25
description/Service/Ingress/example-tls.yml
Normal file
25
description/Service/Ingress/example-tls.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: example-ingress-tls
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-ingress-tls
|
||||
app: ingress
|
||||
type: ingress
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- https-example.foo.com
|
||||
secretName: testsecret-tls
|
||||
rules:
|
||||
- host: https-example.foo.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: service1
|
||||
port:
|
||||
number: 80
|
||||
42
description/Service/Service/description.yml
Normal file
42
description/Service/Service/description.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
# Service 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/services-networking/service
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Service
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Service 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Service 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 指定 Service 类型【ClusterIP:通过集群的内部 IP 暴露服务,选择该值时服务只能够在集群内部访问;NodePort:通过每个节点上的 IP 和静态端口(NodePort)暴露服务;LoadBalancer:使用云提供商的负载均衡器向外部暴露服务;ExternalName:通过返回 CNAME 和对应值,可以将服务映射到 externalName 字段的内容】
|
||||
type: Service 类型
|
||||
## 指定 Pod 选择器( 此 Service 需要暴露哪些 Pod )
|
||||
selector:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 端口号
|
||||
ports:
|
||||
### 端口号1
|
||||
#### 端口名称
|
||||
- name:
|
||||
#### 端口类型
|
||||
protocol: 端口类型
|
||||
#### Service 端口号
|
||||
port: Service 端口号
|
||||
#### Pod 端口号
|
||||
targetPort: Pod 端口号
|
||||
### Node 端口号(仅 type 为 NodePort 时使用)
|
||||
nodePort: Node 端口号
|
||||
## ExternalName(仅 type 为 ExternalName 时使用)
|
||||
externalName: ExternalName
|
||||
## 指定外部IP(该 Service 允许通过哪些外部 IP:Port 访问)
|
||||
externalIPs:
|
||||
- externalIP1:Port1
|
||||
- externalIP2:Port2
|
||||
16
description/Service/Service/example-externalips.yml
Normal file
16
description/Service/Service/example-externalips.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-externalips
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-externalips
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
externalIPs:
|
||||
- 80.11.12.10
|
||||
12
description/Service/Service/example-externalname.yml
Normal file
12
description/Service/Service/example-externalname.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-externalname
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-externalname
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
type: ExternalName
|
||||
externalName: my.database.example.com
|
||||
21
description/Service/Service/example-multi.yml
Normal file
21
description/Service/Service/example-multi.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-multi
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-multi
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
- name: https
|
||||
protocol: TCP
|
||||
port: 443
|
||||
targetPort: 9377
|
||||
17
description/Service/Service/example-nodeport.yml
Normal file
17
description/Service/Service/example-nodeport.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-nodeport
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-nodeport
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30007
|
||||
16
description/Service/Service/example-single.yml
Normal file
16
description/Service/Service/example-single.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-single
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-single
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
33
description/Storage/PersistentVolumeClaims/description.yml
Normal file
33
description/Storage/PersistentVolumeClaims/description.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
# PersistentVolumeClaim(持久卷申领)说明,官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/persistent-volumes
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源名称
|
||||
kind: PersistentVolumeClaim
|
||||
# 资源元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 该 PersistentVolumeClaim 的名称【自定义,见名知意】
|
||||
# 内容
|
||||
spec:
|
||||
## 资源
|
||||
resources:
|
||||
requests:
|
||||
### 容量
|
||||
storage: 该 PersistentVolumeClaim 使用的空间大小【自定义,单位使用量纲,如:Ki、Mi、Gi、Ti、Pi、Ei】
|
||||
## 卷模式
|
||||
volumeMode: 该 PersistentVolumeClaim 使用的卷模式【Filesystem:默认,文件系统;Block:块】
|
||||
## 访问模式
|
||||
accessModes:
|
||||
- 该 PersistentVolumeClaim 使用的访问模式【ReadWriteOnce:卷可以被一个节点以读写方式挂载;ReadOnlyMany:卷可以被多个节点以只读方式挂载;ReadWriteMany:卷可以被多个节点以读写方式挂载;ReadWriteOncePod:卷可以被单个 Pod 以读写方式挂载(整个集群中只有一个 Pod 可以读取和写入)】
|
||||
## Storage Class 名称
|
||||
storageClassName: 该 PersistentVolumeClaim 使用的 StorageClass 的名称
|
||||
## 指定 PersistentVolume ( 配置后该 PersistentVolumeClaim 只能绑定指定的 PersistentVolume )
|
||||
volumeName: PersistentVolume 的名称
|
||||
## 选择器
|
||||
selector:
|
||||
### 卷必须包含带有此值的标签
|
||||
matchLabels:
|
||||
name: value
|
||||
### 通过设定键(key)、值列表和操作符(operator) 来构造的需求
|
||||
matchExpressions:
|
||||
- {key: key的值, operator: operator的值【In:包含;NotIn:不包含;Exists:存在;DoesNotExist:不存在】,values: [value的值1,value的值2,...]}
|
||||
17
description/Storage/PersistentVolumeClaims/example.yml
Normal file
17
description/Storage/PersistentVolumeClaims/example.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: pvc-example
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
storageClassName: storage-local-example
|
||||
selector:
|
||||
matchLabels:
|
||||
release: "stable"
|
||||
matchExpressions:
|
||||
- {key: environment, operator: In, values: [dev]}
|
||||
34
description/Storage/PersistentVolumes/description.yml
Normal file
34
description/Storage/PersistentVolumes/description.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
# PersistentVolume(持久卷)说明,官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/persistent-volumes
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源名称
|
||||
kind: PersistentVolume
|
||||
# 资源元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 该 PersistentVolume 的名称【自定义,见名知意】
|
||||
# 内容
|
||||
spec:
|
||||
## 资源
|
||||
capacity:
|
||||
### 容量
|
||||
storage: 该 PersistentVolume 使用的空间大小【自定义,单位使用量纲,如:Ki、Mi、Gi、Ti、Pi、Ei】
|
||||
## 卷模式
|
||||
volumeMode: 该 PersistentVolume 使用的卷模式【Filesystem:默认,文件系统;Block:块】
|
||||
## 访问模式
|
||||
accessModes:
|
||||
- 该 PersistentVolume 使用的访问模式【ReadWriteOnce:卷可以被一个节点以读写方式挂载;ReadOnlyMany:卷可以被多个节点以只读方式挂载;ReadWriteMany:卷可以被多个节点以读写方式挂载;ReadWriteOncePod:卷可以被单个 Pod 以读写方式挂载(整个集群中只有一个 Pod 可以读取和写入)】
|
||||
## 回收策略
|
||||
persistentVolumeReclaimPolicy: 该 PersistentVolume 使用的回收策略【Retain:保留、手动回收(当 PersistentVolumeClaim 被删除时,PersistentVolume 仍然存在,需要手动删除 PersistentVolume 及 PersistentVolume 中的数据);Delete:删除(当 PersistentVolumeClaim 被删除时,自动删除 PersistentVolume 及 PersistentVolume 中的数据)】
|
||||
## StorageClass 名称
|
||||
storageClassName: 该 PersistentVolume 使用的 StorageClass 的名称
|
||||
## 预留 PersistentVolume(配置该 PersistentVolume 只能被指定的 PersistentVolumeClaim 绑定)
|
||||
claimRef:
|
||||
name: PersistentVolumeClaim 的名称
|
||||
namespace: Namespace 的名称
|
||||
## 挂载选项
|
||||
mount-options:
|
||||
挂载选项参数【 不同类型的存储类型参数不一样,具体见官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/persistent-volumes/#mount-options 】
|
||||
## 节点亲和性
|
||||
nodeAffinity:
|
||||
节点亲和性参数【 local 存储类型需要声明,具体见官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/persistent-volumes/#node-affinity 】
|
||||
24
description/Storage/PersistentVolumes/example-local.yml
Normal file
24
description/Storage/PersistentVolumes/example-local.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-local-example
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-example
|
||||
local:
|
||||
path: /data/k8s/pv/local/example
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- nodename-example-1
|
||||
- nodename-example-2
|
||||
- nodename-example-3
|
||||
14
description/Storage/PersistentVolumes/example-nfs.yml
Normal file
14
description/Storage/PersistentVolumes/example-nfs.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: pv-nfs-example
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
nfs:
|
||||
server: nfs-server.default.svc.cluster.local
|
||||
path: "/"
|
||||
mountOptions:
|
||||
- nfsvers=4.2
|
||||
23
description/Storage/StorageClass/description.yml
Normal file
23
description/Storage/StorageClass/description.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
# StorageClass(存储类) 说明,官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/storage-classes
|
||||
# API 版本
|
||||
apiVersion: storage.k8s.io/v1
|
||||
# 资源名称
|
||||
kind: StorageClass
|
||||
# 资源元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 该 StorageClass 的名称【自定义,见名知意】
|
||||
# 制备器(供应商)
|
||||
provisioner: 该 StorageClass 使用的制备器【可选制备器见官方文档: https://kubernetes.io/zh-cn/docs/concepts/storage/storage-classes/#provisioner 】
|
||||
# 回收策略
|
||||
reclaimPolicy: 该 StorageClass 的回收策略【Delete:删除(默认,当使用此 PersistentVolume 的对象被删除时,此 PersistentVolume 自动删除);Retain:保留(当使用此 PersistentVolume 的对象被删除时,此 PersistentVolume 不会自动删除)】
|
||||
# 卷捆绑模型
|
||||
volumeBindingMode: 该 StorageClass 的绑定模式【Immediate:默认,PersistentVolumeClaim 创建后立即完成制备和绑定;WaitForFirstConsumer:使用 PersistentVolumeClaim 的 Pod 被创建后才制备和绑定】
|
||||
# 允许的拓扑结构
|
||||
allowedTopologies: 该 StorageClass 允许的拓扑架构【具体见官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/storage-classes/#allowed-topologies 】
|
||||
# 是否允许卷扩展
|
||||
allowVolumeExpansion: 是否允许卷扩展【true:允许;false:不允许。仅部分制备器可用,具体见官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/storage-classes/#allow-volume-expansion 】
|
||||
# 挂载选项
|
||||
mountOptions: 该 StorageClass 的挂载选项【仅部分制备器可用,具体见官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/persistent-volumes/#mount-options 】
|
||||
# 参数
|
||||
parameters: 该 StorageClass 的参数【使用不同类型的制备器时参数不一样,具体见官方文档:https://kubernetes.io/zh-cn/docs/concepts/storage/storage-classes/#parameters 】
|
||||
7
description/Storage/StorageClass/example-local.yml
Normal file
7
description/Storage/StorageClass/example-local.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-example
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
42
description/Strategy/HorizontalPodAutoscaler/description.yml
Normal file
42
description/Strategy/HorizontalPodAutoscaler/description.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
# HorizontalPodAutoscaler(Pod 水平自动扩缩)说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/tasks/run-application/horizontal-pod-autoscale
|
||||
# API 版本
|
||||
apiVersion: autoscaling/v2
|
||||
# 资源类型
|
||||
kind: HorizontalPodAutoscaler
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 HorizontalPodAutoscaler 的名称
|
||||
## 命名空间
|
||||
namespace: 此 HorizontalPodAutoscaler 所属的命名空间
|
||||
# 数据
|
||||
spec:
|
||||
## 扩缩目标
|
||||
scaleTargetRef:
|
||||
### 扩缩目标的 API 版本
|
||||
apiVersion: apps/v1
|
||||
### 扩缩目标的资源类型
|
||||
kind: Deployment
|
||||
### 扩缩目标的资源名称
|
||||
name: php-apache
|
||||
## 最小副本数
|
||||
minReplicas: 1
|
||||
## 最大副本数
|
||||
maxReplicas: 10
|
||||
## 指标
|
||||
metrics:
|
||||
### 指标1
|
||||
#### 指标类型【Resource:资源(如 CPU、内存等);Pods:Kubernetes Pods;Object:对象】
|
||||
- type: Resource
|
||||
#### 指标详情
|
||||
resource:
|
||||
##### 指标名称
|
||||
name: cpu
|
||||
##### 指标
|
||||
target:
|
||||
###### 类型 【Utilization:百分比;AverageValue:绝对值】
|
||||
type: Utilization
|
||||
###### 数值(百分比)【仅当 type 为 Utilization 时生效】
|
||||
averageUtilization: 50
|
||||
###### 数值(绝对值)【仅当 type 为 AverageValue 时生效】
|
||||
averageValue: 0
|
||||
19
description/Strategy/HorizontalPodAutoscaler/example.yml
Normal file
19
description/Strategy/HorizontalPodAutoscaler/example.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: hpa-example
|
||||
namespace: demo
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: php-apache
|
||||
minReplicas: 1
|
||||
maxReplicas: 10
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 50
|
||||
35
description/Strategy/LimitRanges/description.yml
Normal file
35
description/Strategy/LimitRanges/description.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
# LimitRange(限制范围)说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/policy/limit-range
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: LimitRange
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 LimitRange 的名称
|
||||
## 命名空间
|
||||
namespace: 此 LimitRange 所属的命名空间
|
||||
# 数据
|
||||
spec:
|
||||
## 限制详情
|
||||
limits:
|
||||
### 默认值
|
||||
- default:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
### 默认请求值
|
||||
defaultRequest:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
### 最大值
|
||||
max:
|
||||
cpu: 800m
|
||||
memory: 2Gi
|
||||
storage: 5Gi
|
||||
### 最小值
|
||||
min:
|
||||
cpu: 200m
|
||||
memory: 500Mi
|
||||
storage: 1Gi
|
||||
### 限制类型
|
||||
type: Container
|
||||
22
description/Strategy/LimitRanges/example.yml
Normal file
22
description/Strategy/LimitRanges/example.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: v1
|
||||
kind: LimitRange
|
||||
metadata:
|
||||
name: limit-range-example
|
||||
namespace: demo
|
||||
spec:
|
||||
limits:
|
||||
- default:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
defaultRequest:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
max:
|
||||
cpu: 800m
|
||||
memory: 2Gi
|
||||
storage: 5Gi
|
||||
min:
|
||||
cpu: 200m
|
||||
memory: 500Mi
|
||||
storage: 1Gi
|
||||
type: Container
|
||||
22
description/Strategy/PodDisruptionBudget/description.yml
Normal file
22
description/Strategy/PodDisruptionBudget/description.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
# PodDisruptionBudget(Pod干扰预算)说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/tasks/run-application/configure-pdb
|
||||
# API 版本
|
||||
apiVersion: policy/v1beta1
|
||||
# 资源类型
|
||||
kind: PodDisruptionBudget
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 PodDisruptionBudget 的名称
|
||||
## 命名空间
|
||||
namespace: 此 PodDisruptionBudget 所属的命名空间
|
||||
# 数据
|
||||
spec:
|
||||
## 最少可用 Pod 数(可配置绝对值或百分比,不能和 maxUnavailable 同时存在)
|
||||
minAvailable: 2
|
||||
## 最大不可用 Pod 数(可配置绝对值或百分比,不能和 minAvailable 同时存在)
|
||||
maxUnavailable: 50%
|
||||
## 作用的 Pod 集合
|
||||
selector:
|
||||
### 标签选择
|
||||
matchLabels:
|
||||
name: value
|
||||
10
description/Strategy/PodDisruptionBudget/example.yml
Normal file
10
description/Strategy/PodDisruptionBudget/example.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: pdb-example
|
||||
namespace: demo
|
||||
spec:
|
||||
minAvailable: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: zookeeper
|
||||
69
description/Strategy/ResourceQuotas/description-item.yml
Normal file
69
description/Strategy/ResourceQuotas/description-item.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
# ResourceQuota (资源配额)说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/policy/resource-quotas
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: ResourceQuota
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 ResourceQuota 的名称
|
||||
## 命名空间
|
||||
namespace: 此 ResourceQuota 所属的命名空间
|
||||
# 数据
|
||||
spec:
|
||||
## 配额
|
||||
hard:
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其 CPU 需求总量不能超过该值
|
||||
cpu: '1000'
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存需求总量不能超过该值
|
||||
memory: 200Gi
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其 CPU 限额总量不能超过该值
|
||||
limits.cpu: '1000'
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存限额总量不能超过该值
|
||||
limits.memory: 200Gi
|
||||
### 在该命名空间中,所有 PVC,存储资源的需求总量不能超过该值
|
||||
requests.storage: 1Ti
|
||||
### 在该命名空间中,对于 <storage-class-name> 类型的 PVC,存储资源的需求总量不能超过该值
|
||||
<storage-class-name>.storageclass.storage.k8s.io/requests.storage: 300Gi
|
||||
### 在该命名空间中,允许的 PVC 总量
|
||||
persistentvolumeclaims: '1000'
|
||||
### 在该命名空间中,允许的 <storage-class-name> 类型的 PVC 总量
|
||||
<storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims: '300'
|
||||
### 在该命名空间中,允许存在的 ReplicationController 总数上限
|
||||
replicationcontrollers: '1000'
|
||||
### 在该命名空间中,允许存在的 ResourceQuota 总数上限
|
||||
resourcequotas: '100'
|
||||
### 在该命名空间中,允许存在的 ConfigMap 总数上限
|
||||
configmaps: '1000'
|
||||
### 在该命名空间中,允许存在的 Secret 总数上限
|
||||
secrets: '1000'
|
||||
### 在该命名空间中,允许存在的 Service 总数上限
|
||||
services: '100'
|
||||
### 在该命名空间中,允许存在的 LoadBalancer 类型的 Service 总数上限
|
||||
services.loadbalancers: '100'
|
||||
### 在该命名空间中,允许存在的 NodePort 类型的 Service 总数上限
|
||||
services.nodeports: '100'
|
||||
### 在该命名空间中,允许存在的非终止状态的 Pod 总数上限
|
||||
pods: '100'
|
||||
## 配额作用域
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
### 匹配所有引用了所指定的优先级类的 Pods【 operator 可选:In(包含)、NotIn(不包含)、Exists(存在)、DoesNotExist(不存在);values 可选:low、medium、high】
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- high
|
||||
### 匹配所有 spec.activeDeadlineSeconds 不小于 0 的 Pod(不能和 NotTerminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: Terminating
|
||||
operator: Exists
|
||||
### 匹配所有 spec.activeDeadlineSeconds 是 nil 的 Pod(不能和 Terminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotTerminating
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 是 BestEffort 的 Pod(不能和 NotBestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: BestEffort
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 不是 BestEffort 的 Pod(不能和 BestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotBestEffort
|
||||
operator: Exists
|
||||
### 匹配那些设置了跨名字空间 (反)亲和性条件的 Pod
|
||||
- scopeName: CrossNamespaceAffinity
|
||||
80
description/Strategy/ResourceQuotas/description-list.yml
Normal file
80
description/Strategy/ResourceQuotas/description-list.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
# ResourceQuota (资源配额)( List )说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/policy/resource-quotas
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: List
|
||||
# 资源详情
|
||||
items:
|
||||
## ResourceQuota 1
|
||||
### API 版本
|
||||
- apiVersion: v1
|
||||
### 资源类型
|
||||
kind: ResourceQuota
|
||||
### 元数据
|
||||
metadata:
|
||||
#### 名称
|
||||
name: 此 ResourceQuota 的名称
|
||||
#### 命名空间
|
||||
namespace: 此 ResourceQuota 所属的命名空间
|
||||
### 数据
|
||||
spec:
|
||||
#### 配额
|
||||
hard:
|
||||
##### 在该命名空间中,所有非终止状态的 Pod,其 CPU 需求总量不能超过该值
|
||||
cpu: '1000'
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存需求总量不能超过该值
|
||||
memory: 200Gi
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其 CPU 限额总量不能超过该值
|
||||
limits.cpu: ''
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存限额总量不能超过该值
|
||||
limits.memory:
|
||||
### 在该命名空间中,所有 PVC,存储资源的需求总量不能超过该值
|
||||
requests.storage: 1Ti
|
||||
### 在该命名空间中,对于 <storage-class-name> 类型的 PVC,存储资源的需求总量不能超过该值
|
||||
<storage-class-name>.storageclass.storage.k8s.io/requests.storage: 300Gi
|
||||
### 在该命名空间中,允许的 PVC 总量
|
||||
persistentvolumeclaims: '1000'
|
||||
### 在该命名空间中,允许的 <storage-class-name> 类型的 PVC 总量
|
||||
<storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims: '300'
|
||||
### 在该命名空间中,允许存在的 ReplicationController 总数上限
|
||||
replicationcontrollers: '1000'
|
||||
### 在该命名空间中,允许存在的 ResourceQuota 总数上限
|
||||
resourcequotas: '100'
|
||||
### 在该命名空间中,允许存在的 ConfigMap 总数上限
|
||||
configmaps: '1000'
|
||||
### 在该命名空间中,允许存在的 Secret 总数上限
|
||||
secrets: '1000'
|
||||
### 在该命名空间中,允许存在的 Service 总数上限
|
||||
services: '100'
|
||||
### 在该命名空间中,允许存在的 LoadBalancer 类型的 Service 总数上限
|
||||
services.loadbalancers: '100'
|
||||
### 在该命名空间中,允许存在的 NodePort 类型的 Service 总数上限
|
||||
services.nodeports: '100'
|
||||
### 在该命名空间中,允许存在的非终止状态的 Pod 总数上限
|
||||
pods: '100'
|
||||
## 配额作用域
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
### 匹配所有引用了所指定的优先级类的 Pods【 operator 可选:In(包含)、NotIn(不包含)、Exists(存在)、DoesNotExist(不存在);values 可选:low、medium、high】
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- high
|
||||
### 匹配所有 spec.activeDeadlineSeconds 不小于 0 的 Pod(不能和 NotTerminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: Terminating
|
||||
operator: Exists
|
||||
### 匹配所有 spec.activeDeadlineSeconds 是 nil 的 Pod(不能和 Terminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotTerminating
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 是 BestEffort 的 Pod(不能和 NotBestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: BestEffort
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 不是 BestEffort 的 Pod(不能和 BestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotBestEffort
|
||||
operator: Exists
|
||||
### 匹配那些设置了跨名字空间 (反)亲和性条件的 Pod
|
||||
- scopeName: CrossNamespaceAffinity
|
||||
## ResourceQuota 2
|
||||
### API 版本
|
||||
- apiVersion: v1
|
||||
...
|
||||
69
description/Strategy/ResourceQuotas/description_item.yml
Normal file
69
description/Strategy/ResourceQuotas/description_item.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
# ResourceQuota (资源配额)说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/policy/resource-quotas/
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: ResourceQuota
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 ResourceQuota 的名称
|
||||
## 命名空间
|
||||
namespace: 此 ResourceQuota 所属的命名空间
|
||||
# 数据
|
||||
spec:
|
||||
## 配额
|
||||
hard:
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其 CPU 需求总量不能超过该值
|
||||
cpu: '1000'
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存需求总量不能超过该值
|
||||
memory: 200Gi
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其 CPU 限额总量不能超过该值
|
||||
limits.cpu: ''
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存限额总量不能超过该值
|
||||
limits.memory:
|
||||
### 在该命名空间中,所有 PVC,存储资源的需求总量不能超过该值
|
||||
requests.storage: 1Ti
|
||||
### 在该命名空间中,对于 <storage-class-name> 类型的 PVC,存储资源的需求总量不能超过该值
|
||||
<storage-class-name>.storageclass.storage.k8s.io/requests.storage: 300Gi
|
||||
### 在该命名空间中,允许的 PVC 总量
|
||||
persistentvolumeclaims: '1000'
|
||||
### 在该命名空间中,允许的 <storage-class-name> 类型的 PVC 总量
|
||||
<storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims: '300'
|
||||
### 在该命名空间中,允许存在的 ReplicationController 总数上限
|
||||
replicationcontrollers: '1000'
|
||||
### 在该命名空间中,允许存在的 ResourceQuota 总数上限
|
||||
resourcequotas: '100'
|
||||
### 在该命名空间中,允许存在的 ConfigMap 总数上限
|
||||
configmaps: '1000'
|
||||
### 在该命名空间中,允许存在的 Secret 总数上限
|
||||
secrets: '1000'
|
||||
### 在该命名空间中,允许存在的 Service 总数上限
|
||||
services: '100'
|
||||
### 在该命名空间中,允许存在的 LoadBalancer 类型的 Service 总数上限
|
||||
services.loadbalancers: '100'
|
||||
### 在该命名空间中,允许存在的 NodePort 类型的 Service 总数上限
|
||||
services.nodeports: '100'
|
||||
### 在该命名空间中,允许存在的非终止状态的 Pod 总数上限
|
||||
pods: '100'
|
||||
## 配额作用域
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
### 匹配所有引用了所指定的优先级类的 Pods【 operator 可选:In(包含)、NotIn(不包含)、Exists(存在)、DoesNotExist(不存在);values 可选:low、medium、high】
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- high
|
||||
### 匹配所有 spec.activeDeadlineSeconds 不小于 0 的 Pod(不能和 NotTerminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: Terminating
|
||||
operator: Exists
|
||||
### 匹配所有 spec.activeDeadlineSeconds 是 nil 的 Pod(不能和 Terminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotTerminating
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 是 BestEffort 的 Pod(不能和 NotBestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: BestEffort
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 不是 BestEffort 的 Pod(不能和 BestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotBestEffort
|
||||
operator: Exists
|
||||
### 匹配那些设置了跨名字空间 (反)亲和性条件的 Pod
|
||||
- scopeName: CrossNamespaceAffinity
|
||||
80
description/Strategy/ResourceQuotas/description_list.yml
Normal file
80
description/Strategy/ResourceQuotas/description_list.yml
Normal file
@@ -0,0 +1,80 @@
|
||||
# ResourceQuota (资源配额)( List )说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/policy/resource-quotas/
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: List
|
||||
# 资源详情
|
||||
items:
|
||||
## ResourceQuota 1
|
||||
### API 版本
|
||||
- apiVersion: v1
|
||||
### 资源类型
|
||||
kind: ResourceQuota
|
||||
### 元数据
|
||||
metadata:
|
||||
#### 名称
|
||||
name: 此 ResourceQuota 的名称
|
||||
#### 命名空间
|
||||
namespace: 此 ResourceQuota 所属的命名空间
|
||||
### 数据
|
||||
spec:
|
||||
#### 配额
|
||||
hard:
|
||||
##### 在该命名空间中,所有非终止状态的 Pod,其 CPU 需求总量不能超过该值
|
||||
cpu: '1000'
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存需求总量不能超过该值
|
||||
memory: 200Gi
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其 CPU 限额总量不能超过该值
|
||||
limits.cpu: ''
|
||||
### 在该命名空间中,所有非终止状态的 Pod,其内存限额总量不能超过该值
|
||||
limits.memory:
|
||||
### 在该命名空间中,所有 PVC,存储资源的需求总量不能超过该值
|
||||
requests.storage: 1Ti
|
||||
### 在该命名空间中,对于 <storage-class-name> 类型的 PVC,存储资源的需求总量不能超过该值
|
||||
<storage-class-name>.storageclass.storage.k8s.io/requests.storage: 300Gi
|
||||
### 在该命名空间中,允许的 PVC 总量
|
||||
persistentvolumeclaims: '1000'
|
||||
### 在该命名空间中,允许的 <storage-class-name> 类型的 PVC 总量
|
||||
<storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims: '300'
|
||||
### 在该命名空间中,允许存在的 ReplicationController 总数上限
|
||||
replicationcontrollers: '1000'
|
||||
### 在该命名空间中,允许存在的 ResourceQuota 总数上限
|
||||
resourcequotas: '100'
|
||||
### 在该命名空间中,允许存在的 ConfigMap 总数上限
|
||||
configmaps: '1000'
|
||||
### 在该命名空间中,允许存在的 Secret 总数上限
|
||||
secrets: '1000'
|
||||
### 在该命名空间中,允许存在的 Service 总数上限
|
||||
services: '100'
|
||||
### 在该命名空间中,允许存在的 LoadBalancer 类型的 Service 总数上限
|
||||
services.loadbalancers: '100'
|
||||
### 在该命名空间中,允许存在的 NodePort 类型的 Service 总数上限
|
||||
services.nodeports: '100'
|
||||
### 在该命名空间中,允许存在的非终止状态的 Pod 总数上限
|
||||
pods: '100'
|
||||
## 配额作用域
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
### 匹配所有引用了所指定的优先级类的 Pods【 operator 可选:In(包含)、NotIn(不包含)、Exists(存在)、DoesNotExist(不存在);values 可选:low、medium、high】
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- high
|
||||
### 匹配所有 spec.activeDeadlineSeconds 不小于 0 的 Pod(不能和 NotTerminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: Terminating
|
||||
operator: Exists
|
||||
### 匹配所有 spec.activeDeadlineSeconds 是 nil 的 Pod(不能和 Terminating 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotTerminating
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 是 BestEffort 的 Pod(不能和 NotBestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: BestEffort
|
||||
operator: Exists
|
||||
### 匹配所有 Qos 不是 BestEffort 的 Pod(不能和 BestEffort 同时存在)【 operator 必须为 Exists,不能设置 values 】
|
||||
- scopeName: NotBestEffort
|
||||
operator: Exists
|
||||
### 匹配那些设置了跨名字空间 (反)亲和性条件的 Pod
|
||||
- scopeName: CrossNamespaceAffinity
|
||||
## ResourceQuota 2
|
||||
### API 版本
|
||||
- apiVersion: v1
|
||||
...
|
||||
24
description/Strategy/ResourceQuotas/example-item.yml
Normal file
24
description/Strategy/ResourceQuotas/example-item.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: resource-quota-example-item
|
||||
namespace: demo
|
||||
spec:
|
||||
hard:
|
||||
cpu: '64'
|
||||
memory: 256Gi
|
||||
requests.storage: 1Ti
|
||||
persistentvolumeclaims: '1000'
|
||||
resourcequotas: '100'
|
||||
configmaps: '3000'
|
||||
secrets: '3000'
|
||||
services: '100'
|
||||
services.loadbalancers: '100'
|
||||
services.nodeports: '100'
|
||||
pods: '100'
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- high
|
||||
69
description/Strategy/ResourceQuotas/example-list.yml
Normal file
69
description/Strategy/ResourceQuotas/example-list.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
apiVersion: v1
|
||||
kind: List
|
||||
items:
|
||||
- apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: resource-quota-example-list-high
|
||||
namespace: demo
|
||||
spec:
|
||||
hard:
|
||||
cpu: '128'
|
||||
memory: 512Gi
|
||||
requests.storage: 1Ti
|
||||
persistentvolumeclaims: '1000'
|
||||
resourcequotas: '100'
|
||||
configmaps: '1000'
|
||||
secrets: '1000'
|
||||
services: '100'
|
||||
pods: '1000'
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- high
|
||||
- apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: resource-quota-example-list-medium
|
||||
namespace: demo
|
||||
spec:
|
||||
hard:
|
||||
cpu: '64'
|
||||
memory: 256Gi
|
||||
requests.storage: 1Ti
|
||||
persistentvolumeclaims: '500'
|
||||
resourcequotas: '100'
|
||||
configmaps: '500'
|
||||
secrets: '500'
|
||||
services: '50'
|
||||
pods: '500'
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- medium
|
||||
- apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: resource-quota-example-list-low
|
||||
namespace: demo
|
||||
spec:
|
||||
hard:
|
||||
cpu: '32'
|
||||
memory: 128Gi
|
||||
requests.storage: 1Ti
|
||||
persistentvolumeclaims: '100'
|
||||
resourcequotas: '10'
|
||||
configmaps: '50'
|
||||
secrets: '50'
|
||||
services: '10'
|
||||
pods: '50'
|
||||
scopeSelector:
|
||||
matchExpressions:
|
||||
- scopeName: PriorityClass
|
||||
operator: In
|
||||
values:
|
||||
- low
|
||||
42
description/Workload/CronJob/description.yml
Normal file
42
description/Workload/CronJob/description.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
# CronJob 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/cron-jobs
|
||||
# API 版本
|
||||
apiVersion: batch/v1
|
||||
# 资源类型
|
||||
kind: CronJob
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 CronJob 的名称
|
||||
## 命名空间
|
||||
namespace: 此 CronJob 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 此 CronJob 的执行周期【语法见:https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/cron-jobs/#cron-%E6%97%B6%E9%97%B4%E8%A1%A8%E8%AF%AD%E6%B3%95】
|
||||
schedule: 此 CronJob 的执行周期
|
||||
## 此 CronJob 执行的 Job
|
||||
jobTemplate:
|
||||
### Job 的内容
|
||||
spec:
|
||||
#### 指定 Job 的 Pod 模板(内容参考 Pod 的 Yaml)
|
||||
template:
|
||||
##### Pod 的内容
|
||||
spec:
|
||||
###### Pod 的容器
|
||||
containers:
|
||||
####### 容器1
|
||||
######## 容器1的名称
|
||||
- name: 容器1的名称
|
||||
######## 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
######## 镜像拉取规则
|
||||
imagePullPolicy: IfNotPresent
|
||||
######## 执行的命令
|
||||
command:
|
||||
- 命令1
|
||||
- 命令2
|
||||
###### 容器重启策略【Never:不重启,OnFailure:失败时重启】
|
||||
restartPolicy: 容器重启策略【Never:不重启,OnFailure:失败时重启】
|
||||
24
description/Workload/CronJob/example-hello.yml
Normal file
24
description/Workload/CronJob/example-hello.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: example-hello
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-hello
|
||||
app: hello
|
||||
type: cronjob
|
||||
spec:
|
||||
schedule: "*/1 * * * *"
|
||||
jobTemplate:
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: hello
|
||||
image: busybox
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- date; echo Hello from the Kubernetes cluster
|
||||
restartPolicy: OnFailure
|
||||
95
description/Workload/DaemonSet/description.yml
Normal file
95
description/Workload/DaemonSet/description.yml
Normal file
@@ -0,0 +1,95 @@
|
||||
# DaemonSet 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/daemonset
|
||||
# API 版本
|
||||
apiVersion: apps/v1
|
||||
# 资源类型
|
||||
kind: DaemonSet
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 DaemonSet 的名称
|
||||
## 命名空间
|
||||
namespace: 此 DaemonSet 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 指定 Pod 选择器( 此 DaemonSet 需要管理哪些 Pod )
|
||||
selector:
|
||||
### 指定标签选择器
|
||||
matchLabels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 指定 Pod 模板
|
||||
template:
|
||||
### Pod 的元数据
|
||||
metadata:
|
||||
#### Pod 的标签(需要和上面 matchLabels 中配置的标签一致)
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的容忍度(需要在哪些节点上部署 Pod )
|
||||
tolerations:
|
||||
##### Pod 的容忍度 1
|
||||
###### 容忍度 1 的 key
|
||||
- key: 容忍度 1 的 key
|
||||
###### 容忍度 1 的表达式【Equal:等于,Exists:存在】
|
||||
operator: 容忍度 1 的表达式
|
||||
###### 容忍度 1 的值
|
||||
value: 容忍度 1 的值
|
||||
###### 容忍度 1 的效果
|
||||
effect: 容忍度 1 的效果
|
||||
#### Pod 的终止宽限期(秒)
|
||||
terminationGracePeriodSeconds: Pod 的终止宽限期(秒)
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1的资源
|
||||
resources:
|
||||
####### 限制资源
|
||||
limits:
|
||||
######## 限制的内存
|
||||
memory: 限制的内存
|
||||
####### 请求资源
|
||||
requests:
|
||||
######## 请求的 CPU
|
||||
cpu: 请求的 CPU
|
||||
######## 请求的内存
|
||||
memory: 请求的内存
|
||||
###### 容器1使用的持久卷
|
||||
volumeMounts:
|
||||
####### 持久卷1
|
||||
######## 持久卷1的名称
|
||||
- name: 持久卷1的名称
|
||||
######## 持久卷1的挂载路径(容器内)
|
||||
mountPath: 持久卷1的挂载路径(容器内)
|
||||
####### 持久卷2
|
||||
######## 持久卷2的名称
|
||||
- name: 持久卷2的名称
|
||||
######## 持久卷2的挂载路径(容器内)
|
||||
mountPath: 持久卷2的挂载路径(容器内)
|
||||
######## 容器内是否只读
|
||||
readOnly: true
|
||||
#### 持久卷
|
||||
volumes:
|
||||
##### 持久卷1
|
||||
###### 持久卷1的名称
|
||||
- name: 持久卷1的名称
|
||||
###### 持久卷1的路径(宿主机目录)
|
||||
hostPath:
|
||||
####### 持久卷1的路径(宿主机目录)
|
||||
path: 持久卷1的路径(宿主机目录)
|
||||
##### 持久卷2
|
||||
###### 持久卷2的名称
|
||||
- name: 持久卷2的名称
|
||||
###### 持久卷2的路径(宿主机目录)
|
||||
hostPath:
|
||||
####### 持久卷2的路径(宿主机目录)
|
||||
path: 持久卷2的路径(宿主机目录)
|
||||
@@ -0,0 +1,49 @@
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: example-elasticsearch-fluentd
|
||||
namespace: demo
|
||||
labels:
|
||||
name: elasticsearch-fluentd
|
||||
app: elasticsearch-fluentd
|
||||
type: daemonset
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: elasticsearch-fluentd
|
||||
app: elasticsearch-fluentd
|
||||
type: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: elasticsearch-fluentd
|
||||
app: elasticsearch-fluentd
|
||||
type: pod
|
||||
spec:
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
operator: Exists
|
||||
effect: NoSchedule
|
||||
terminationGracePeriodSeconds: 30
|
||||
containers:
|
||||
- name: fluentd-elasticsearch
|
||||
image: quay.io/fluentd_elasticsearch/fluentd:v2.5.2
|
||||
resources:
|
||||
limits:
|
||||
memory: 200Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 200Mi
|
||||
volumeMounts:
|
||||
- name: varlog
|
||||
mountPath: /var/log
|
||||
- name: varlibdockercontainers
|
||||
mountPath: /var/lib/docker/containers
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: varlog
|
||||
hostPath:
|
||||
path: /var/log
|
||||
- name: varlibdockercontainers
|
||||
hostPath:
|
||||
path: /var/lib/docker/containers
|
||||
45
description/Workload/Deployment/description.yml
Normal file
45
description/Workload/Deployment/description.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
# Deployment 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/deployment
|
||||
# API 版本
|
||||
apiVersion: apps/v1
|
||||
# 资源类型
|
||||
kind: Deployment
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Deployment 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Deployment 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 指定副本数
|
||||
replicas: 期望副本数
|
||||
## 指定 Pod 选择器( 此 Deployment 需要管理哪些 Pod )
|
||||
selector:
|
||||
### 指定标签选择器
|
||||
matchLabels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 指定 Pod 模板
|
||||
template:
|
||||
### Pod 的元数据
|
||||
metadata:
|
||||
#### Pod 的标签(需要和上面 matchLabels 中配置的标签一致)
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1使用的端口号
|
||||
ports:
|
||||
- containerPort: 80
|
||||
28
description/Workload/Deployment/example-nginx.yml
Normal file
28
description/Workload/Deployment/example-nginx.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: example-nginx
|
||||
namespace: demo
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: deployment
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.23.3
|
||||
ports:
|
||||
- containerPort: 80
|
||||
45
description/Workload/Deployments/description.yml
Normal file
45
description/Workload/Deployments/description.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
# Deployments 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/deployment
|
||||
# API 版本
|
||||
apiVersion: apps/v1
|
||||
# 资源类型
|
||||
kind: Deployments
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Deployments 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Deployments 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 指定副本数
|
||||
replicas: 期望副本数
|
||||
## 指定 Pod 选择器( 此 Deployments 需要管理哪些 Pods )
|
||||
selector:
|
||||
### 指定标签选择器
|
||||
matchLabels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 指定 Pod 模板
|
||||
template:
|
||||
### Pod 的元数据
|
||||
metadata:
|
||||
#### Pod 的标签(需要和上面 matchLabels 中配置的标签一致)
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1使用的端口号
|
||||
ports:
|
||||
- containerPort: 80
|
||||
28
description/Workload/Deployments/example-nginx.yml
Normal file
28
description/Workload/Deployments/example-nginx.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployments
|
||||
metadata:
|
||||
name: example-nginx
|
||||
namespace: demo
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: deployments
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.23.3
|
||||
ports:
|
||||
- containerPort: 80
|
||||
48
description/Workload/Job/description.yml
Normal file
48
description/Workload/Job/description.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
# Job 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/job
|
||||
# API 版本
|
||||
apiVersion: batch/v1
|
||||
# 资源类型
|
||||
kind: Job
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Job 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Job 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 是否挂起此 Job(true:挂起,false:不挂起(立即执行))
|
||||
suspend: 是否挂起此 Job
|
||||
## 指定 Pod 模板(内容参考 Pod 的 Yaml)
|
||||
template:
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1运行的命令
|
||||
command:
|
||||
- 命令1
|
||||
- 命令2
|
||||
#### 容器重启策略【Never:不重启,OnFailure:失败时重启】
|
||||
restartPolicy: 容器重启策略【Never:不重启,OnFailure:失败时重启】
|
||||
## 失败重试次数(重试次数到达此值后,此 Job 标记为失败)
|
||||
backoffLimit: 失败重试次数
|
||||
## Job 活跃期限(秒)(Job 运行时间达到此值后,此 Job 标记为失败,优先级高于 backoffLimit)
|
||||
activeDeadlineSeconds: Job 活跃期限(秒)
|
||||
## Pod 完成模式【NonIndexed:当成功完成的 Pod 个数达到 .spec.completions 所设值时认为 Job 已经完成,Indexed:Job 的 Pod 会获得对应的完成索引,取值为 0 到 .spec.completions-1,当每个索引都对应一个完成完成的 Pod 时,Job 被认为是已完成的】
|
||||
completionMode: Pod 完成模式
|
||||
## Pod 完成量(当成功的 Pod 个数达到次数时,该 Job 视为完成)
|
||||
completions: Pod 完成量
|
||||
## Pod 工作队列
|
||||
parallelism: Pod 工作队列
|
||||
## Job 完成(状态为 Complete 或 Failed)后自动清除时间(秒)
|
||||
ttlSecondsAfterFinished: Job 完成(状态为 Complete 或 Failed)后自动清除时间(秒)
|
||||
18
description/Workload/Job/example-pi.yml
Normal file
18
description/Workload/Job/example-pi.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: example-pi
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-pi
|
||||
app: pi
|
||||
type: job
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pi
|
||||
image: perl
|
||||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 4
|
||||
40
description/Workload/Jobs/description.yml
Normal file
40
description/Workload/Jobs/description.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
# Jobs 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/job
|
||||
# API 版本
|
||||
apiVersion: apps/v1
|
||||
# 资源类型
|
||||
kind: Jobs
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Jobs 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Jobs 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 指定 Pod 模板(内容参考 Pod 的 Yaml)
|
||||
template:
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1运行的命令
|
||||
command:
|
||||
- 命令1
|
||||
- 命令2
|
||||
#### 容器重启策略【Never:不重启,OnFailure:失败时重启】
|
||||
restartPolicy: 容器重启策略【Never:不重启,OnFailure:失败时重启】
|
||||
## 失败重试次数
|
||||
backoffLimit: 4
|
||||
## Pod 完成量(当成功的 Pod 个数达到次数时,该 Job 视为完成)
|
||||
completions: Pod 完成量
|
||||
## Pod 工作队列
|
||||
parallelism: Pod 工作队列
|
||||
18
description/Workload/Jobs/example-pi.yml
Normal file
18
description/Workload/Jobs/example-pi.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Jobs
|
||||
metadata:
|
||||
name: example-pi
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-pi
|
||||
app: pi
|
||||
type: job
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: pi
|
||||
image: perl
|
||||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 4
|
||||
33
description/Workload/Pod/description.yml
Normal file
33
description/Workload/Pod/description.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
# Pod 说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/pods
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Pod
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Pod 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Pod 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 容器
|
||||
containers:
|
||||
### 容器1
|
||||
#### 容器名称
|
||||
- name: 该容器的名称
|
||||
#### 容器镜像
|
||||
image: 改容器使用的镜像
|
||||
#### 容器端口号
|
||||
ports:
|
||||
##### 端口号1
|
||||
###### 名称
|
||||
- name: 该端口号的名称
|
||||
###### 端口号
|
||||
containerPort: 端口号
|
||||
###### 端口类型
|
||||
protocol: 该端口号的类型
|
||||
17
description/Workload/Pod/example-nginx.yml
Normal file
17
description/Workload/Pod/example-nginx.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: example-nginx
|
||||
namespace: demo
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: nginx:1.23.3
|
||||
ports:
|
||||
- name: web
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
33
description/Workload/Pods/description.yml
generated
Normal file
33
description/Workload/Pods/description.yml
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
# Pods 说明,官方文档:https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/pods
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Pods
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Pods 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Pods 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 容器
|
||||
containers:
|
||||
### 容器1
|
||||
#### 容器名称
|
||||
- name: 该容器的名称
|
||||
#### 容器镜像
|
||||
image: 改容器使用的镜像
|
||||
#### 容器端口号
|
||||
ports:
|
||||
##### 端口号1
|
||||
###### 名称
|
||||
- name: 该端口号的名称
|
||||
###### 端口号
|
||||
containerPort: 端口号
|
||||
###### 端口类型
|
||||
protocol: 该端口号的类型
|
||||
17
description/Workload/Pods/example-nginx.yml
generated
Normal file
17
description/Workload/Pods/example-nginx.yml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Pods
|
||||
metadata:
|
||||
name: example-nginx
|
||||
namespace: demo
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: nginx:1.23.3
|
||||
ports:
|
||||
- name: web
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
83
description/Workload/StatefulSet/description.yml
Normal file
83
description/Workload/StatefulSet/description.yml
Normal file
@@ -0,0 +1,83 @@
|
||||
# StatefulSet 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/statefulset
|
||||
# API 版本
|
||||
apiVersion: apps/v1
|
||||
# 资源类型
|
||||
kind: StatefulSet
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 StatefulSet 的名称
|
||||
## 命名空间
|
||||
namespace: 此 StatefulSet 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 服务名称
|
||||
serviceName: 服务名称(此 StatefulSet 对应的 Service 的 name )
|
||||
## 指定副本数
|
||||
replicas: 期望副本数
|
||||
## 指定更新策略
|
||||
updateStrategy:
|
||||
type: 更新策略【OnDelete:不自动更新 Pod;RollingUpdate:自动滚动更新(默认)】
|
||||
## 最短就绪秒数
|
||||
minReadySeconds: 短就绪秒数( Pod 就绪后默认可用的等待时间,默认为 0,即 Pod 就绪后即为可用状态)
|
||||
## 指定 Pod 选择器( 此 StatefulSet 需要管理哪些 Pod )
|
||||
selector:
|
||||
### 指定标签选择器
|
||||
matchLabels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 指定 Pod 模板(内容参考 Pod 的 Yaml)
|
||||
template:
|
||||
### Pod 的元数据
|
||||
metadata:
|
||||
#### Pod 的标签(需要和上面 matchLabels 中配置的标签一致)
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的终止宽限期(秒)
|
||||
terminationGracePeriodSeconds: Pod 的终止宽限期(秒)
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1使用的端口号
|
||||
ports:
|
||||
####### 端口号1
|
||||
######## 端口号1的名称
|
||||
- name: 端口号1的名称
|
||||
######## 端口号1的端口号
|
||||
containerPort: 端口号1的端口号
|
||||
###### 容器1使用的持久卷
|
||||
volumeMounts:
|
||||
######## 持久卷1
|
||||
######## 持久卷1的名称
|
||||
- name: 持久卷1的名称
|
||||
######## 持久卷1的挂载路径(容器内)
|
||||
mountPath: 持久卷1的挂载路径(容器内)
|
||||
## 指定 PersistentVolumeClaims 模板(内容参考 PersistentVolumeClaims 的 Yaml)
|
||||
volumeClaimTemplates:
|
||||
### PersistentVolumeClaims 1
|
||||
#### PersistentVolumeClaims 1 的元数据
|
||||
- metadata:
|
||||
##### PersistentVolumeClaims 1 的名称
|
||||
name: PersistentVolumeClaims 1 的名称
|
||||
#### PersistentVolumeClaims 1 的内容
|
||||
spec:
|
||||
##### 访问模式
|
||||
accessModes:
|
||||
- PersistentVolumeClaims 1 的访问模式
|
||||
##### Storage Class 名称
|
||||
storageClassName: PersistentVolumeClaims 1 使用的 StorageClass 的名称
|
||||
##### 资源
|
||||
resources:
|
||||
requests:
|
||||
storage: PersistentVolumeClaim 1 使用的空间大小
|
||||
49
description/Workload/StatefulSet/example-nginx-slim.yml
Normal file
49
description/Workload/StatefulSet/example-nginx-slim.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: example-nginx-slim
|
||||
namespace: demo
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: statefulset
|
||||
spec:
|
||||
serviceName: example-nginx-slim
|
||||
replicas: 3
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
minReadySeconds: 0
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 10
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.23.3-alpine-slim
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
- name: https
|
||||
containerPort: 443
|
||||
volumeMounts:
|
||||
- name: html
|
||||
mountPath: /usr/share/nginx/html
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: html
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: example-storage-class-nginx-html
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
83
description/Workload/StatefulSets/description.yml
Normal file
83
description/Workload/StatefulSets/description.yml
Normal file
@@ -0,0 +1,83 @@
|
||||
# StatefulSets 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/workloads/controllers/statefulset
|
||||
# API 版本
|
||||
apiVersion: apps/v1
|
||||
# 资源类型
|
||||
kind: StatefulSets
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 StatefulSets 的名称
|
||||
## 命名空间
|
||||
namespace: 此 StatefulSets 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 服务名称
|
||||
serviceName: 服务名称(此 StatefulSets 对应的 Service 的 name )
|
||||
## 指定副本数
|
||||
replicas: 期望副本数
|
||||
## 指定更新策略
|
||||
updateStrategy:
|
||||
type: 更新策略【OnDelete:不自动更新 Pod;RollingUpdate:自动滚动更新(默认)】
|
||||
## 最短就绪秒数
|
||||
minReadySeconds: 短就绪秒数( Pod 就绪后默认可用的等待时间,默认为 0,即 Pod 就绪后即为可用状态)
|
||||
## 指定 Pod 选择器( 此 StatefulSets 需要管理哪些 Pods )
|
||||
selector:
|
||||
### 指定标签选择器
|
||||
matchLabels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 指定 Pod 模板(内容参考 Pod 的 Yaml)
|
||||
template:
|
||||
### Pod 的元数据
|
||||
metadata:
|
||||
#### Pod 的标签(需要和上面 matchLabels 中配置的标签一致)
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
### Pod 的内容
|
||||
spec:
|
||||
#### Pod 的终止宽限期(秒)
|
||||
terminationGracePeriodSeconds: Pod 的终止宽限期(秒)
|
||||
#### Pod 的容器
|
||||
containers:
|
||||
##### 容器1
|
||||
###### 容器1的名称
|
||||
- name: 容器1的名称
|
||||
###### 容器1使用的镜像
|
||||
image: 容器1使用的镜像
|
||||
###### 容器1使用的端口号
|
||||
ports:
|
||||
####### 端口号1
|
||||
######## 端口号1的名称
|
||||
- name: 端口号1的名称
|
||||
######## 端口号1的端口号
|
||||
containerPort: 端口号1的端口号
|
||||
###### 容器1使用的持久卷
|
||||
volumeMounts:
|
||||
######## 持久卷1
|
||||
######## 持久卷1的名称
|
||||
- name: 持久卷1的名称
|
||||
######## 持久卷1的挂载路径(容器内)
|
||||
mountPath: 持久卷1的挂载路径(容器内)
|
||||
## 指定 PersistentVolumeClaims 模板(内容参考 PersistentVolumeClaims 的 Yaml)
|
||||
volumeClaimTemplates:
|
||||
### PersistentVolumeClaims 1
|
||||
#### PersistentVolumeClaims 1 的元数据
|
||||
- metadata:
|
||||
##### PersistentVolumeClaims 1 的名称
|
||||
name: PersistentVolumeClaims 1 的名称
|
||||
#### PersistentVolumeClaims 1 的内容
|
||||
spec:
|
||||
##### 访问模式
|
||||
accessModes:
|
||||
- PersistentVolumeClaims 1 的访问模式
|
||||
##### Storage Class 名称
|
||||
storageClassName: PersistentVolumeClaims 1 使用的 StorageClass 的名称
|
||||
##### 资源
|
||||
resources:
|
||||
requests:
|
||||
storage: PersistentVolumeClaim 1 使用的空间大小
|
||||
49
description/Workload/StatefulSets/example-nginx-slim.yml
Normal file
49
description/Workload/StatefulSets/example-nginx-slim.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSets
|
||||
metadata:
|
||||
name: example-nginx-slim
|
||||
namespace: demo
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: statefulsets
|
||||
spec:
|
||||
serviceName: example-nginx-slim
|
||||
replicas: 3
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
minReadySeconds: 0
|
||||
selector:
|
||||
matchLabels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: nginx
|
||||
app: nginx
|
||||
type: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 10
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:1.23.3-alpine-slim
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
- name: https
|
||||
containerPort: 443
|
||||
volumeMounts:
|
||||
- name: html
|
||||
mountPath: /usr/share/nginx/html
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: html
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: example-storage-class-nginx-html
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
Reference in New Issue
Block a user