在我的公司,Kubernetes 集群是由一个团队管理的,我们必须提供一个命名空间,然后创建我们的资源。我们不能使用诸如hostPath
卷之类的特性,也不能创建新的角色或命名空间等。
fluentd-elasticsearch
因此,将容器的示例实现视为 a DaemonSet
,它们似乎都在使用 hostPath 卷安装,但我不知道为什么。
例如,我通过了这个: https ://www.howtoforge.com/create-a-daemonset-in-kubernetes/
并创建了这个:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: my-fluentd-elasticsearch-daemonset
namespace: kube-system
labels:
k8s-app: fluentd-logging
spec:
selector:
matchLabels:
name: fluentd-elasticsearch
template:
metadata:
labels:
name: fluentd-elasticsearch
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
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
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
但是得到了这个错误:
Error creating: pods "fluentd-elasticsearch-" is forbidden: unable to validate against any pod
security policy: [spec.volumes[0]: Invalid value: "hostPath": hostPath volumes are not allowed
to be used spec.volumes[1]: Invalid value: "hostPath": hostPath volumes are not allowed to be
used]
所以我有几个问题:
- 流利的安装卷然后读取那些被推送到弹性搜索的卷中的文件吗?
- 我可以仅删除卷安装还是对其运行至关重要?
- fluentd 是否完全使用 kubernetes API?
- 是否有任何非守护程序集容器只会使用 kubernetes API 来获取 pod,然后使用 log api 转发到 log db?