How do you remove the deploymentConfig, image streams, etc using Openshift OC?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In OpenShift, deleting an application usually means deleting several related resources, not just one object. If you only remove the pod controller and leave image streams, services, routes, or build configs behind, the project stays cluttered and future deployments become harder to reason about.
Identify What Exists
Start by confirming the current project and listing the resources that belong to the app. This prevents the most common mistake: deleting objects in the wrong namespace.
If the app is already labeled consistently, inspect by label instead of scanning the entire namespace:
Older OpenShift setups often use DeploymentConfig rather than Kubernetes Deployment. You can remove a single deployment config directly:
That only deletes the deployment config itself. It does not automatically remove services, routes, image streams, build configs, or unrelated secrets.
Delete the Application Resources
When you know the resource names, explicit deletion is the safest option. It makes the cleanup readable and avoids accidental matches.
For a more complete cleanup, include other objects created during deployment:
If you want a single command and your labels are reliable, delete by label:
This pattern matters because all is narrower than many people expect. In OpenShift and Kubernetes, all typically covers workload and networking primitives such as pods, services, replica sets, deployments, and deployment configs, but not every resource type in the namespace.
Remove Everything in Another Namespace
Use -n when the target app lives outside the current project. That keeps the command self-contained and easier to review in shell history.
You can preview the target set first:
If you are cleaning up temporary environments, add --ignore-not-found so reruns do not fail when some resources are already gone.
Verify That the Cleanup Worked
After deletion, check whether any dependent objects remain. A route or image stream left behind can make the environment look half-removed.
If pods are terminating for too long, inspect finalizers or dependent storage:
Persistent volume claims usually need separate review. You should only remove them when you are sure the application data is no longer needed.
Common Pitfalls
- Running
oc deletein the wrong project. Checkoc projectfirst, or pass-nexplicitly. - Assuming
oc delete allremoves image streams, build configs, config maps, secrets, or persistent volume claims. It does not cover every object type. - Deleting by label when labels are inconsistent. Verify with
oc get ... -l app=myappbefore using delete. - Removing an image stream tag and expecting the entire image stream to disappear.
is/myapp:latestandis/myappare different targets. - Forgetting that routes and services are separate resources. Removing the deployment config alone does not delete external access.
Summary
- Use
oc getfirst to see exactly which resources belong to the application. - Delete individual objects by name when you want the safest, most auditable cleanup.
- Use label-based deletion only when labels are consistent across all related resources.
- Remember that
oc delete alldoes not mean every resource in the namespace. - Verify the result with follow-up
oc getcommands, especially for image streams, routes, and storage.
Related reading
- How does gRPC connection work on kubernetes service ClusterIP
- How does k8s service route the traffic to mulitiple endpoints
- How does kubectl port-forward create a connection?
- How does kubernetes get the imagefs.available and nodefs.available eviction signals?
- how does kubernetes guarantee reliability of kube proxy and kubelet?
- How does Kubernetes' scheduler work?
- How does one add a node or nodes to an existing YugaByte DB CE cluster?
- How does the GKE metadata server work in Workload Identity

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.