Terraform Backend MongoDB
Let's see how to deploy Terraform Backend MongoDB on a Kubernetes cluster.
Repository
Make sure to have the devpro Helm repository:
bash
helm repo add devpro https://devpro.github.io/helm-charts
helm repo updateConfiguration
Create the values.yaml file to override default parameters.
yaml
dotnet:
environment: Development
enableSwagger: true
enableOpenTelemetry: falseyaml
webapi:
host: tfbackend.mydomain
ingress:
enabled: true
className: traefik # or nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prodyaml
mongodb:
enabled: true
auth:
rootPassword: admin
webapi:
db:
connectionString: mongodb://root:admin@tfbackend-mongodb:27017/tfbackend_beta?authSource=admin
databaseName: tfbackend_betaDeployment
Install the application:
bash
helm upgrade --install tfbackend devpro/terraform-backend-mongodb -f values.yaml -namespace tfbackend --create-namespaceOptional checks
If enabled, open the Swagger page from the browser (<url>/swagger).
Forward MongoDB port for local access:
bash
kubectl port-forward service/tfbackend-mongodb 27017:27017 -n tfbackendUse MongoDB Compass to look at the database.
Clean-up
Uninstall the application and delete the namespace:
bash
helm delete tfbackend -n tfbackend
kubectl delete ns tfbackend