Integrate EventMesh with K8S
1. Dependencies
dockergolang (version 1.19)kubernetes (kubectl)There is some compatibility between kubernetes an docker, please check the version compatibility between them and download the corresponding version to ensure that they work properly together.
2. Start
Go to the eventmesh-operator directory.
cd eventmesh-operator
Install CRD into the specified k8s cluster.
make install# Uninstall CRDs from the K8s clustermake uninstall
If you get error eventmesh-operator/bin/controller-gen: No such file or directory, Run the following command:
# download controller-gen locally if necessary.make controller-gen# download kustomize locally if necessary.make kustomize
View crds information:
# run the following command to view crds information:kubectl get crdsNAME CREATED ATconnectors.eventmesh-operator.eventmesh 2023-11-28T01:35:21Zruntimes.eventmesh-operator.eventmesh 2023-11-28T01:35:21Z
Create and delete CRs:
Custom resource objects are located at: /config/samples
When deleting CR, simply replace create with delete.
# Create CR for eventmesh-runtime、eventmesh-connector-rocketmq,Creating a clusterIP lets eventmesh-runtime communicate with other components.make create#success:configmap/runtime-config createdruntime.eventmesh-operator.eventmesh/eventmesh-runtime createdservice/runtime-cluster-service createdconfigmap/connector-rocketmq-config createdconnectors.eventmesh-operator.eventmesh/connector-rocketmq created# View the created Service.kubectl get serviceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEruntime-cluster-service ClusterIP 10.109.209.72 <none> 10000/TCP 17s# Delete CRmake delete
Run eventmesh-operator create pods.
# run controllermake run# loggo fmt ./...go vet ./...go run ./main.goINFO controller-runtime.metrics Metrics server is starting to listen {"addr": ":9020"}INFO setup starting managerINFO Starting server {"kind": "health probe", "addr": "[::]:8081"}INFO Starting server {"path": "/metrics", "kind": "metrics", "addr": "[::]:9020"}INFO runtime Creating a new eventMeshRuntime StatefulSet. {"StatefulSet.Namespace": "default", "StatefulSet.Name": "eventmesh-runtime-0-a"}INFO connector Creating a new Connector StatefulSet. {"StatefulSet.Namespace": "default", "StatefulSet.Name": "connector-rocketmq"}INFO runtime Successful reconciliation!INFO connector Successful reconciliation!# After the pods are successfully started, run the following command to view pods.kubectl get podsNAME READY STATUS RESTARTS AGEconnector-rocketmq-0 1/1 Running 0 12meventmesh-runtime-0-a-0 1/1 Running 0 12m
