Old ConfigMaps from previous builds remain in the k8s cluster

Proposal: Cleanup outdated ConfigMaps generated by Tutor (Kustomize)

Context

While deploying Open edX with Tutor on Kubernetes, I’ve noticed that old ConfigMaps from previous builds remain in the cluster. This happens because Tutor (via Kustomize) generates new ConfigMaps whenever configuration changes, but never removes the old ones.

Over time, this leads to:

  • Cluttered namespaces (e.g., multiple lms-settings- objects).
  • Harder debugging (kubectl get cm lists many unused configs).
  • Potential resource quota or performance concerns in large environments.

Problem

Currently, tutor k8s start does not clean up resources that are no longer defined in the manifests. This is a known limitation when not using --prune.

Proposed Solution

Enable optional cleanup by:

  1. Using kubectl apply --prune when applying manifests.
  2. Making this behavior configurable (e.g., via an arguments for tutor k8s start like --prune-configmaps) to avoid surprises for existing deployments.

Benefits

  • Automatically removes unused ConfigMaps and Secrets.
  • Keeps clusters clean and easier to manage.
  • Reduces confusion during upgrades and rollbacks.
1 Like