Istio Namespace Management
What You'll Learn
You'll learn how to enable Istio per namespace and control which workloads get the Envoy sidecar proxy automatically injected using Kubernetes labels.
Why Namespace-Level Control Matters
Not every namespace in your cluster needs Istio. Development namespaces, system utilities, or legacy applications might not benefit from service mesh features. Istio gives you namespace-level control over sidecar injection, allowing you to opt namespaces in or out of the mesh explicitly.
Think of it like choosing which neighborhoods in a city get the new smart traffic system—you don't deploy it everywhere at once; you enable it strategically where it adds value.
Enabling Istio for a Namespace
The most common approach uses a namespace label to enable automatic sidecar injection:
kubectl label namespace my-app istio-injection=enabled
Once labeled, any new pods created in my-app will automatically get an Envoy sidecar container injected alongside the application container. Existing pods won't be affected until they're restarted or recreated.
Controlling Injection Granularly
You can also disable injection for specific namespaces:
kubectl label namespace my-legacy-app istio-injection=disabled
Or remove the label entirely to use Istio's default behavior (typically no injection unless explicitly enabled):
kubectl label namespace my-app istio-injection-
This namespace-level approach keeps configuration simple and declarative—you can see at a glance which namespaces participate in the mesh by inspecting labels.
Verifying Namespace Configuration
Check which namespaces have Istio enabled:
kubectl get namespace -L istio-injection
Key Takeaway: Istio namespace management uses the istio-injection=enabled label to control automatic sidecar injection per namespace, giving you precise control over which parts of your cluster join the service mesh without requiring per-pod configuration.