
Appsmith Helm Chart 如何启用 MongoDB Community Operator 替代内置副本集【免费下载链接】appsmithPlatform to build admin panels, internal tools, and dashboards. Integrates with 25 databases and any API.项目地址: https://gitcode.com/GitHub_Trending/ap/appsmith在 Kubernetes 上部署 Appsmith 时Helm Chart 默认捆绑 Bitnami MongoDB 子图默认 2 成员副本集镜像appsmith/mongodb:6.0.27。如果你希望改由 MongoDB Kubernetes Operator 来管理副本集Appsmith Chart 提供了对应路径开启mongodbCommunity.enabled后Chart 会渲染一个MongoDBCommunity自定义资源CR由 Operator 负责副本集成员管理、SCRAM 凭证生命周期并生成 Appsmith 直接消费的连接串 Secret——不需要手工拼接APPSMITH_DB_URL。适用前提该路径是 chart 3.7.0 引入的 Preview 特性官方文档明确说明本版本仅覆盖全新安装仓库当前 chart 版本为 3.9.1见 Chart.yaml。如果集群上已有带生产数据的 Bitnami 版 Appsmith release不要直接改mongodbCommunity.enabled迁移文档正在另行准备。准备条件按 docs/install-mongodb-operator.md 给出的要求Kubernetes 1.28Helm 3.14kubectl已配置指向目标集群集群有默认StorageClass或者准备通过--set global.storageClassname显式指定不需要单独安装 Operator——Chart 可以通过子图把它一并装上Chart 依赖mongodb-kubernetes1.8.0条件为mongodbOperator.enabled。主路径全新安装并捆绑 Operatorhelm repo add appsmith https://helm.appsmith.com helm repo update kubectl create namespace appsmith helm install appsmith appsmith/appsmith -n appsmith --wait --timeout 10m \ --set mongodb.enabledfalse \ --set mongodbCommunity.enabledtrue \ --set mongodbOperator.enabledtrue三个关键开关的作用Flag用途mongodb.enabledfalse不部署默认的 Bitnami MongoDB 子图mongodbCommunity.enabledtrue部署供 Operator 调谐的MongoDBCommunityCRmongodbOperator.enabledtrue在同一命名空间安装上游 MongoDB Kubernetes Operator 子图安装新 release 时推荐开启mongodbCommunity.enabled后Chart 实际做三件事见 templates/mongodb-community.yaml渲染MongoDBCommunityCR副本集类型SCRAM 认证appsmith/appsmith用户带readWrite和clusterMonitor角色在未提供密码 Secret 时运行一次幂等的 pre-install Job 生成随机密码并写入 Secret见 templates/hooks/mongodb-community.yaml把 Appsmith 工作负载的 MongoDB 连接串接到 Operator 管理的 Secret 上。验证安装结果kubectl get pods -n appsmith kubectl get mongodbcommunity -n appsmith文档给出的期望输出文档示例abridgedPod 名和标签按你的环境会有差异NAME READY STATUS appsmith-0 1/1 Running appsmith-mongo-0 2/2 Running appsmith-postgresql-0 1/1 Running appsmith-redis-master-0 1/1 Running mongodb-kubernetes-operator-... 1/1 Running NAME PHASE VERSION appsmith-mongo Running 8.0.20判断标准是MongoDBCommunity的PHASE变为Running、appsmith-0进入Running。随后用 port-forward 打开 UI 确认可用kubectl port-forward -n appsmith svc/appsmith 8080:80打开 http://localhost:8080。生产访问则另行配置 Ingress这一步不在本路径范围内。核对密码与连接串MongoDB 用户密码存放在名为mongodbCommunity.name-password的 Secret——release 名为appsmith、使用默认命名时即appsmith-mongo-passwordkubectl get secret appsmith-mongo-password -n appsmith \ -o jsonpath{.data.password} | base64 -dAppsmith 自身从 Operator 管理的 Secret 读取连接串可在 templates/NOTES.txt 中看到这个 Secret 名的推导逻辑对应命令kubectl get secret appsmith-mongo-appsmith-appsmith -n appsmith \ -o jsonpath{.data.connectionString\.standardSrv} | base64 -d可选分支自带密码 Secret如果密码由 Vault、SOPS、ExternalSecrets 等外部体系管理先自己创建 Secret必须只有一个名为password的 key 存放明文密码再指向它kubectl create secret generic my-mongodb-secret \ -n appsmith \ --from-literalpasswordyour-password helm install appsmith appsmith/appsmith -n appsmith --wait --timeout 10m \ --set mongodb.enabledfalse \ --set mongodbCommunity.enabledtrue \ --set mongodbOperator.enabledtrue \ --set mongodbCommunity.auth.passwordSecretNamemy-mongodb-secretyour-password替换为你自己确定的密码值。设置mongodbCommunity.auth.passwordSecretName后Chart 跳过 pre-install Job并假定 Secret 已正确填充——Job 不存在的检查责任在你这边。生产环境的副本集配置Chart 默认值面向评估和开发环境单成员副本集、storageSize: 10Gi见 values.yamlMongoDB 功能完整但没有故障切换。文档建议生产上扩到 3 成员、固定资源并显式指定 StorageClassmongodbCommunity: enabled: true members: 3 # replica set size (odd number recommended) persistent: storageSize: 100Gi storageClass: gp3 # or omit to use cluster default resources: requests: cpu: 500m memory: 2Gi limits: memory: 4Gimembers从 1 调到 3 属于 upgrade 时的 values 变更Operator 会在线把成员加进副本集文档说明该过程无停机。常见问题排查MongoDBCommunity停在Pending阶段先看 Operator 日志定位原因kubectl logs -n appsmith -l app.kubernetes.io/namemongodb-kubernetes-operator --tail50文档列出的两个常见原因你设置了passwordSecretName但对应 Secret 不存在或缺少passwordkeyMongoDB 镜像拉不下来——用kubectl describe pod mongodbCommunity.name-0查看 image-pull 错误。Appsmith Pod 卡在InitAppsmith 的 init 容器会等待 MongoDB 可达。先确认kubectl get mongodbcommunity -n appsmith的 phase若 phase 已是Running但 Appsmith 仍不前进查看 init 容器日志kubectl logs -n appsmith appsmith-0 -c mongo-init-container密码初始化 Job 报ImagePullBackOffmongodbCommunity.name-password-initJob 的 Pod 默认使用docker.io/alpine/kubectl:latest集群无法访问 Docker Hub隔离环境或拉取策略限制时会卡住。把passwordInit.image覆盖到自有镜像仓库--set mongodbCommunity.passwordInit.image.registrymy-registry.example.com --set mongodbCommunity.passwordInit.image.repositorymy/kubectl --set mongodbCommunity.passwordInit.image.tag1.34.2helm uninstall后命名空间删除卡住MongoDBCommunityCR 带 finalizerOperator 负责移除若 Helm 先拆掉了 Operator Deploymentfinalizer 会残留、命名空间删不掉。手动清空 finalizer 后删除才会继续mongodbCommunity.name替换为实际 CR 名kubectl patch mongodbcommunity -n appsmith mongodbCommunity.name \ --typemerge -p {metadata:{finalizers:[]}}卸载顺序与限制卸载时先删 CR让 Operator 在处理 finalizer 期间仍在运行再卸载 release 和命名空间# 1. Delete the CR and wait for the operator to clear its finalizer kubectl delete mongodbcommunity -n appsmith --all --waittrue # 2. Uninstall Appsmith (and the bundled operator, if enabled) helm uninstall appsmith -n appsmith # 3. Remove the namespace kubectl delete namespace appsmith跳过快捷的第 1 步就可能触发上面说的 finalizer 残留问题。此外要注意子图安装的 MongoDB CRD 在 uninstall 后仍然存在Helm 从不删除crds/下的资源要彻底清理需kubectl delete crd mongodbcommunity.mongodbcommunity.mongodb.com等——这会移除全集群所有匹配资源只有确认没有其他东西依赖该 Operator 时才执行。最后一个边界如果mongodb.enabled与mongodbCommunity.enabled同时为 truetransition 模式templates/NOTES.txt 会提示两套 MongoDB 同时在跑、Appsmith 仍连接 Bitnami 实例并给出 mongodump/mongorestore 的迁移提示。本文主路径是全新安装直接替代不涉及从已有 Bitnami release 的在线迁移。【免费下载链接】appsmithPlatform to build admin panels, internal tools, and dashboards. Integrates with 25 databases and any API.项目地址: https://gitcode.com/GitHub_Trending/ap/appsmith创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考