代码地址:https://github.com/apache/rocketmq-operator.git
git clone https://github.com/apache/rocketmq-operator.git
cd rocketmq-operator
make deploy
注:执行此命令前要安装go
yum -y install go
[root@k8smaster rocketmq-operator]# ./install-operator.sh
go: creating new go.mod: module tmp
Downloading sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0
go get: sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0: Get "https://proxy.golang.org/sigs.k8s.io/controller-tools/cmd/controller-gen/@v/v0.7.0.info": dial tcp 172.217.160.113:443: i/o timeout
make: *** [controller-gen] 错误 1
[root@k8smaster rocketmq-operator]#
解决方法:
export GOPROXY=https://goproxy.cn
/root/rocketmq-operator/bin/controller-gen rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds
Error: err: exit status 1: stderr: go: github.com/google/uuid@v1.1.2: missing go.sum entry; to add it:
go mod download github.com/google/uuid
go: github.com/google/uuid@v1.1.2: missing go.sum entry; to add it:
go mod download github.com/google/uuid
解决方法
go mod tidy
kubectl get pods
NAME READY STATUS RESTARTS AGE
rocketmq-operator-564b5d75d-jllzk 1/1 Running 0 108s
说明成功!
注:我的环境是已经安装了StorageClass
修改example文件夹下的以下文件:
1.rocketmq_v1alpha1_broker_cr.yaml
2.rocketmq_v1alpha1_nameservice_cr.yaml
修改以下两点
kubectl apply -f example/rocketmq_v1alpha1_rocketmq_cluster.yaml
broker.rocketmq.apache.org/broker created
nameservice.rocketmq.apache.org/name-service created
console.rocketmq.apache.org/console created
$ kubectl get pods -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
broker-0-master-0 1/1 Running 0 71s 10.1.5.91 docker-desktop <none> <none>
broker-0-replica-1-0 1/1 Running 0 71s 10.1.5.92 docker-desktop <none> <none>
console-5c4c9d5757-jnsbq 1/1 Running 0 71s 10.1.5.93 docker-desktop <none> <none>
name-service-0 1/1 Running 0 78s 192.168.65.3 docker-desktop <none> <none>
rocketmq-operator-758bb9c774-jrfw4 1/1 Running 0 106s 10.1.5.90 docker-desktop <none> <none>
kubectl apply -f example/rocketmq_v1alpha1_cluster_service.yaml
$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
broker-storage-broker-0-master-0 Bound pvc-7a74871b-c005-441a-bb15-8106566c9d19 8Gi RWO rocketmq-storage 78s
broker-storage-broker-0-replica-1-0 Bound pvc-521e7e9a-3795-487a-9f76-22da74db74dd 8Gi RWO rocketmq-storage 78s
namesrv-storage-name-service-0 Bound pvc-c708cb49-aa52-4992-8cac-f46a48e2cc2e 1Gi RWO rocketmq-storage 79s
$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-521e7e9a-3795-487a-9f76-22da74db74dd 8Gi RWO Delete Bound default/broker-storage-broker-0-replica-1-0 rocketmq-storage 79s
pvc-7a74871b-c005-441a-bb15-8106566c9d19 8Gi RWO Delete Bound default/broker-storage-broker-0-master-0 rocketmq-storage 79s
pvc-d7b76efe-384c-4f8d-9e8a-ebe209ba826c 8Gi RWO Delete Bound default/broker-storage-broker-1-master-0 rocketmq-storage 78s