代码改变世界

k8s install rabbitmq & 删除namespace

2023-10-11 18:31  qgbo  阅读(18)  评论(0编辑  收藏  举报

 

1 kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"
2 kubectl apply -f https://raw.githubusercontent.com/rabbitmq/cluster-operator/main/docs/examples/hello-world/rabbitmq.yaml
3 kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
4 kubectl annotate storageclass local-path storageclass.kubernetes.io/is-default-class=true
5 kubectl port-forward   --address 0.0.0.0 service/hello-world  8080:15672

 https://chanjarster.github.io/post/k8s/delete-namespace/   这样可以删除 namespace

delns=redis 

kubectl  get ns $delns -ojson | jq 'del(.spec)' >aa 

kubectl replace --raw "/api/v1/namespaces/$delns/finalize" -f aa 

 

rabbitmq.yaml 可以指定 replicas
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
    name: hello-world
spec:
  replicas: 3

 

更多详细配置例子:https://github.com/rabbitmq/cluster-operator/tree/main/docs/examples/import-definitions

 

 

reference: https://www.rabbitmq.com/kubernetes/operator/quickstart-operator.html