新增说明及示例文件

This commit is contained in:
2023-12-15 16:39:01 +08:00
committed by huty
parent 823b19c3f0
commit 3445c145aa
71 changed files with 4048 additions and 0 deletions

View 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的路径宿主机目录

View File

@@ -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