設定 Knative Kafka 資源的 KEDA 自動調整¶
所有分派事件的 Knative Kafka 組件(來源、通道代理)都支援使用 KEDA 調整分派器資料平面。
重要
此功能為 Alpha 版
啟用 Kafka 組件的自動調整¶
重要
請注意,啟用自動調整將會為所有 KafkaSources、參考 Kafka Brokers 的 Triggers,以及參考 KafkaChannels 的 Subscriptions 啟用調整。
若要啟用此功能,您需要修改 config-kafka-features
configmap,並將 controller-autoscaler-keda
旗標設定為 enabled
。請注意,為了使此功能正常運作,您還必須在叢集中安裝 KEDA。
變更後,您的 configmap 應該如下所示
apiVersion: v1
kind: ConfigMap
metadata:
name: config-kafka-features
namespace: knative-eventing
data:
controller-autoscaler-keda: enabled
# other features and config options...
設定資源的自動調整¶
如果您想要自訂 KEDA 如何調整 KafkaSource、觸發器或訂閱,您可以在資源上設定註釋
apiVersion: <eventing|messaging|sources>.knative.dev/v1
kind: <KafkaSource|Subscription|Trigger>
metadata:
annotations:
# The minimum number of replicas to scale down to
autoscaling.eventing.knative.dev/min-scale: "0"
# The maximum number of replicas to scale up to
autoscaling.eventing.knative.dev/max-scale: "50"
# The interval in seconds the autoscaler uses to poll metrics in order to inform its scaling decisions
autoscaling.eventing.knative.dev/polling-interval: "10"
# The period in seconds the autoscaler waits until it scales down
autoscaling.eventing.knative.dev/cooldown-period: "30"
# The lag that is used for scaling (1<->N)
autoscaling.eventing.knative.dev/lag-threshold: "100"
# The lag that is used for activation (0<->1)
autoscaling.eventing.knative.dev: "0"
spec:
# Spec fields for the resource...
停用資源的自動調整¶
如果您想要停用 KafkaSource、觸發器或訂閱的自動調整,您需要在資源上設定註釋
apiVersion: <eventing|messaging|sources>.knative.dev/v1
kind: <KafkaSource|Subscription|Trigger>
metadata:
annotations:
autoscaling.eventing.knative.dev/class: disabled
spec:
# Spec fields for the resource...