英文:
Adding tolerations to fluentbit pod and making it persistent
问题
我正在使用Fluentbit作为Pod部署,在这个部署中,我创建了许多连接到Azure Blob容器的Fluentbit Pod。由于存在多个Pod,我尝试添加tolerations,就像在DaemonSet部署中所做的那样,但它不起作用并失败了。而且,每次我删除并启动Pod时,所有的一切都会重新开始。请就如何解决这些问题提供建议。
apiVersion: v1
kind: Pod
metadata:
name: deployment
spec:
volumes:
- name: config_map_name
configMap:
name: config_map_name
- name: pvc_name
persistentVolumeClaim:
claimName: pvc_name
containers:
- name: fluentbit-logger
image: fluent/fluent-bit:2.1.3
env:
- name: FLUENTBIT_USER
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: user
- name: FLUENTBIT_PWD
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: pwd
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "64Mi"
cpu: "100m"
securityContext:
runAsUser: 0
privileged: true
volumeMounts:
- name: config_map_name
mountPath: "/fluent-bit/etc"
- name: pvc_name
mountPath: mount_path
tolerations:
- key: "dedicated"
operator: "Equal"
value: "sgelk"
effect: "NoSchedule"
- key: "dedicated"
operator: "Equal"
value: "kafka"
effect: "NoSchedule"
获取以下错误:
error: error validating "/tmp/fluentbit-deploy.yaml": error validating data: ValidationError(Pod.spec.containers[0]): unknown field "tolerations" in io.k8s.api.core.v1.Container; if you choose to ignore these errors, turn validation off with --validate=false
英文:
I am using fluentbit as a pod deployment where I am creating many fluentbit pods which are attached to azure blob containers. Since multiple pods exist I tried adding tolerations as I did on daemonset deployment but it did not work and failed. Also every time I delete and start the pods reinvests all the the again. Please advise on fixing these issues.
apiVersion: v1
kind: Pod
metadata:
name: deployment
spec:
volumes:
- name: config_map_name
configMap:
name: config_map_name
- name: pvc_name
persistentVolumeClaim:
claimName: pvc_name
containers:
- name: fluentbit-logger
image: fluent/fluent-bit:2.1.3
env:
- name: FLUENTBIT_USER
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: user
- name: FLUENTBIT_PWD
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: pwd
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "64Mi"
cpu: "100m"
securityContext:
runAsUser: 0
privileged: true
volumeMounts:
- name: config_map_name
mountPath: "/fluent-bit/etc"
- name: pvc_name
mountPath: mount_path
tolerations:
- key: "dedicated"
operator: "Equal"
value: "sgelk"
effect: "NoSchedule"
- key: "dedicated"
operator: "Equal"
value: "kafka"
effect: "NoSchedule"
Getting the error as below
error: error validating "/tmp/fluentbit-deploy.yaml": error validating data: ValidationError(Pod.spec.containers[0]): unknown field "tolerations" in io.k8s.api.core.v1.Container; if you choose to ignore these errors, turn validation off with --validate=false
答案1
得分: 1
tolerations
属性需要设置在 Pod 上,但您试图将其设置在容器上(这就是为什么您看到错误消息 "io.k8s.api.core.v1.Container 中未知字段 "tolerations"" 的原因)。您需要编写如下配置:
apiVersion: v1
kind: Pod
metadata:
name: deployment
spec:
volumes:
- name: config_map_name
configMap:
name: config_map_name
- name: pvc_name
persistentVolumeClaim:
claimName: pvc_name
containers:
- name: fluentbit-logger
image: fluent/fluent-bit:2.1.3
env:
- name: FLUENTBIT_USER
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: user
- name: FLUENTBIT_PWD
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: pwd
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "64Mi"
cpu: "100m"
securityContext:
runAsUser: 0
privileged: true
volumeMounts:
- name: config_map_name
mountPath: "/fluent-bit/etc"
- name: pvc_name
mountPath: mount_path
tolerations:
- key: "dedicated"
operator: "Equal"
value: "sgelk"
effect: "NoSchedule"
- key: "dedicated"
operator: "Equal"
value: "kafka"
effect: "NoSchedule"
英文:
The tolerations
attribute needs to be set on the pod, but you are attempting to set it on a container (that's why you see the error "unknown field "tolerations" in io.k8s.api.core.v1.Container"). You would need to write:
apiVersion: v1
kind: Pod
metadata:
name: deployment
spec:
volumes:
- name: config_map_name
configMap:
name: config_map_name
- name: pvc_name
persistentVolumeClaim:
claimName: pvc_name
containers:
- name: fluentbit-logger
image: fluent/fluent-bit:2.1.3
env:
- name: FLUENTBIT_USER
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: user
- name: FLUENTBIT_PWD
valueFrom:
secretKeyRef:
name: fluentbit-secret
key: pwd
resources:
requests:
memory: "32Mi"
cpu: "50m"
limits:
memory: "64Mi"
cpu: "100m"
securityContext:
runAsUser: 0
privileged: true
volumeMounts:
- name: config_map_name
mountPath: "/fluent-bit/etc"
- name: pvc_name
mountPath: mount_path
tolerations:
- key: "dedicated"
operator: "Equal"
value: "sgelk"
effect: "NoSchedule"
- key: "dedicated"
operator: "Equal"
value: "kafka"
effect: "NoSchedule"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论