第 9 章 调优事件配置
9.1. 覆盖 Knative Eventing 系统部署配置 复制链接链接已复制到粘贴板!
您可以通过修改 KnativeEventing 自定义资源 (CR) 中的 deployments spec 来覆盖某些特定部署的默认配置。目前,对于 eventing-controller、eventing-webhook 和 imc-controller 字段以及探测的 readiness 和 liveness 字段支持覆盖默认配置设置。
replicas spec 无法覆盖使用 Horizontal Pod Autoscaler (HPA) 的部署副本数,且不适用于 eventing-webhook 部署。
您只能覆盖部署中默认定义的探测。
所有 Knative Serving 部署都会默认定义一个就绪度和存活度探测,但以下例外:
-
net-kourier-controller和3scale-kourier-gateway仅定义就绪度探测。 -
net-istio-controller和net-istio-webhook定义没有探测。
9.1.1. 覆盖部署配置 复制链接链接已复制到粘贴板!
目前,对于 eventing-controller、eventing-webhook 和 imc-controller 字段以及探测的 readiness 和 liveness 字段支持覆盖默认配置设置。
replicas spec 无法覆盖使用 Horizontal Pod Autoscaler (HPA) 的部署副本数,且不适用于 eventing-webhook 部署。
在以下示例中,KnativeEventing CR 覆盖 eventing-controller 部署,以便:
-
readiness探测超时eventing-controller被设置为 10 秒。 - 部署指定了 CPU 和内存资源限制。
- 部署有 3 个副本。
-
添加
example-label: label标签。 -
添加
example-annotation:注解。 -
nodeSelector字段被设置为选择带有disktype: hdd标签的节点。
KnativeEventing CR 示例
apiVersion: operator.knative.dev/v1beta1
kind: KnativeEventing
metadata:
name: knative-eventing
namespace: knative-eventing
spec:
deployments:
- name: eventing-controller
readinessProbes:
- container: controller
timeoutSeconds: 10
resources:
- container: eventing-controller
requests:
cpu: 300m
memory: 100Mi
limits:
cpu: 1000m
memory: 250Mi
replicas: 3
labels:
example-label: label
annotations:
example-annotation: annotation
nodeSelector:
disktype: hdd
- 1
- 您可以使用
readiness和liveness探测覆盖来覆盖在 Kubernetes API 中指定的一个部署中的一个容器探测的所有字段,与探测 handler:exec,grpc,httpGet, 和tcpSocket相关的字段除外。
KnativeEventing CR 标签和注解设置覆盖部署本身和生成的 Pod 的部署标签和注解。