安装 in-memory-channel
下载 in-memory-channel
# wget https://github.com/knative/eventing/releases/download/knative-v1.12.0/in-memory-channel.yaml
替换 gcr.io
# sed -i '[email protected]@gcr.dockerproxy.com@g' in-memory-channel.yaml
创建 in-memory-channel 资源
# kubectl apply -f in-memory-channel.yaml
serviceaccount/imc-controller created
clusterrolebinding.rbac.authorization.k8s.io/imc-controller created
rolebinding.rbac.authorization.k8s.io/imc-controller created
clusterrolebinding.rbac.authorization.k8s.io/imc-controller-resolver created
serviceaccount/imc-dispatcher created
clusterrolebinding.rbac.authorization.k8s.io/imc-dispatcher created
rolebinding.rbac.authorization.k8s.io/imc-dispatcher-tls-role-binding created
role.rbac.authorization.k8s.io/imc-dispatcher-tls-role created
configmap/config-imc-event-dispatcher created
configmap/config-observability created
configmap/config-tracing created
deployment.apps/imc-controller created
service/inmemorychannel-webhook created
service/imc-dispatcher created
deployment.apps/imc-dispatcher created
customresourcedefinition.apiextensions.k8s.io/inmemorychannels.messaging.knative.dev created
clusterrole.rbac.authorization.k8s.io/imc-addressable-resolver created
clusterrole.rbac.authorization.k8s.io/imc-channelable-manipulator created
clusterrole.rbac.authorization.k8s.io/imc-controller created
clusterrole.rbac.authorization.k8s.io/imc-dispatcher created
role.rbac.authorization.k8s.io/knative-inmemorychannel-webhook created
mutatingwebhookconfiguration.admissionregistration.k8s.io/inmemorychannel.eventing.knative.dev created
validatingwebhookconfiguration.admissionregistration.k8s.io/validation.inmemorychannel.eventing.knative.dev created
secret/inmemorychannel-webhook-certs created
查看 in-memory-channel 资源
# kubectl get pods -n knative-eventing
NAME READY STATUS RESTARTS AGE
eventing-controller-75d79c8bfb-fpv26 1/1 Running 2 (4h20m ago) 43h
eventing-webhook-79bf558944-4j6rn 1/1 Running 2 (4h20m ago) 43h
imc-controller-8d958bbf5-xvhm7 1/1 Running 0 95s
imc-dispatcher-799f9f548-fdd99 1/1 Running 0 95s
安装 mt-channel-broker
下载 mt-channel-broker
# wget https://github.com/knative/eventing/releases/download/knative-v1.12.0/mt-channel-broker.yaml
替换 gcr.io
# sed -i '[email protected]@gcr.dockerproxy.com@g' mt-channel-broker.yaml
创建 mt-channel-broker
# kubectl apply -f mt-channel-broker.yaml
clusterrole.rbac.authorization.k8s.io/knative-eventing-mt-channel-broker-controller created
clusterrole.rbac.authorization.k8s.io/knative-eventing-mt-broker-filter created
role.rbac.authorization.k8s.io/mt-broker-filter created
serviceaccount/mt-broker-filter created
clusterrole.rbac.authorization.k8s.io/knative-eventing-mt-broker-ingress created
role.rbac.authorization.k8s.io/mt-broker-ingress created
serviceaccount/mt-broker-ingress created
clusterrolebinding.rbac.authorization.k8s.io/eventing-mt-channel-broker-controller created
clusterrolebinding.rbac.authorization.k8s.io/knative-eventing-mt-broker-filter created
rolebinding.rbac.authorization.k8s.io/mt-broker-filter created
clusterrolebinding.rbac.authorization.k8s.io/knative-eventing-mt-broker-ingress created
rolebinding.rbac.authorization.k8s.io/mt-broker-ingress created
deployment.apps/mt-broker-filter created
service/broker-filter created
deployment.apps/mt-broker-ingress created
service/broker-ingress created
deployment.apps/mt-broker-controller created
horizontalpodautoscaler.autoscaling/broker-ingress-hpa created
horizontalpodautoscaler.autoscaling/broker-filter-hpa created
查看 mt-channel-broker 资源
# kubectl get pods -n knative-eventing
NAME READY STATUS RESTARTS AGE
eventing-controller-75d79c8bfb-fpv26 1/1 Running 2 (4h23m ago) 43h
eventing-webhook-79bf558944-4j6rn 1/1 Running 2 (4h22m ago) 43h
imc-controller-8d958bbf5-xvhm7 1/1 Running 0 4m2s
imc-dispatcher-799f9f548-fdd99 1/1 Running 0 4m2s
mt-broker-controller-7b98899b48-m45w6 1/1 Running 0 12s
mt-broker-filter-788b867775-gwqn2 1/1 Running 0 13s
mt-broker-ingress-5f5b69fb49-7d6wn 1/1 Running 0 13s
创建 broker
broker-default.yaml
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
name: default
namespace: event-demo
创建 broker 资源
# kubectl apply -f broker-default.yaml
broker.eventing.knative.dev/default created
查看 broker 资源
# kubectl get broker -n event-demo
NAME URL AGE READY REASON
default http://broker-ingress.knative-eventing.svc.wgs.local/event-demo/default 46s True
查看 broker 信息
# kubectl describe broker -n event-demo
Name: default
Namespace: event-demo
Labels: <none>
Annotations: eventing.knative.dev/broker.class: MTChannelBasedBroker
eventing.knative.dev/creator: kubernetes-admin
eventing.knative.dev/lastModifier: kubernetes-admin
API Version: eventing.knative.dev/v1
Kind: Broker
Metadata:
Creation Timestamp: 2023-11-16T06:26:05Z
Generation: 1
Resource Version: 776926
UID: 482d0e5b-acb4-4e10-9c99-b3cc299d87f4
Spec:
Config:
API Version: v1
Kind: ConfigMap
Name: config-br-default-channel
Namespace: knative-eventing
Delivery:
Backoff Delay: PT0.2S
Backoff Policy: exponential
Retry: 10
Status:
Address:
Name: http
URL: http://broker-ingress.knative-eventing.svc.wgs.local/event-demo/default
Annotations:
knative.dev/channelAPIVersion: messaging.knative.dev/v1
knative.dev/channelAddress: http://default-kne-trigger-kn-channel.event-demo.svc.wgs.local
knative.dev/channelKind: InMemoryChannel
knative.dev/channelName: default-kne-trigger
Conditions:
Last Transition Time: 2023-11-16T06:26:05Z
Status: True
Type: Addressable
Last Transition Time: 2023-11-16T06:26:05Z
Message: No dead letter sink is configured.
Reason: DeadLetterSinkNotConfigured
Severity: Info
Status: True
Type: DeadLetterSinkResolved
Last Transition Time: 2023-11-16T06:26:05Z
Status: True
Type: FilterReady
Last Transition Time: 2023-11-16T06:26:05Z
Status: True
Type: IngressReady
Last Transition Time: 2023-11-16T06:26:05Z
Status: True
Type: Ready
Last Transition Time: 2023-11-16T06:26:05Z
Status: True
Type: TriggerChannelReady
Observed Generation: 1
Events: <none>
参考文档
https://knative.dev/docs/eventing/brokers/broker-types/channel-based-broker/
标签:created,eventing,broker,mt,knative,io,channel From: https://www.cnblogs.com/wangguishe/p/17836159.html