istioctl CLI, enable automatic sidecar injection for a namespace, and perform manual (per-workload) injection. It uses the Bookinfo sample app to show sidecar behavior before and after injection.
Prerequisites: a running Kubernetes cluster and kubectl configured to talk to it.
Before you begin
- Ensure
kubectlis configured and can access your cluster. - Choose an Istio release (this lesson uses
1.26.3). Keep youristioctlclient version compatible with the control plane you intend to install.
1) Inspect the cluster and deploy the Bookinfo sample
First, confirm only the standard application pods are present (no Istio sidecars yet):details-v1) to verify it currently contains only the application container and no istio-proxy:
2) Install istioctl client (if not already installed)
Check for theistioctl client:
1.26.3) and add istioctl to your PATH:
Version compatibility note: Use an
istioctl client that matches (or is compatible with) the Istio control plane version you will install. Mixing incompatible versions can cause install or runtime issues.3) Install the Istio control plane (demo profile)
Install Istio into the cluster using thedemo profile for an easier, feature-rich setup suitable for demos and labs:
istio-system pods are running:
4) Enable automatic sidecar injection for the default namespace
Run an analysis to detect if the namespace is enabled for injection:
default namespace to enable automatic sidecar injection:
istio-proxy. One simple way is to do a rollout restart for the relevant deployments:
istio-proxy). The terminal screenshot below demonstrates the change from 1/1 to 2/2 for injected pods.

istio-proxy container (snippet):
5) Reinstall Bookinfo (optional)
If you prefer to recreate the Bookinfo app so that all pods are freshly created with the proxy already injected, delete and reapply the Bookinfo manifest:default namespace and will automatically include the sidecar.
6) Demonstrate manual (per-workload) injection
Automatic injection is namespace-scoped. You can also inject sidecars for individual manifests when you cannot or do not want to label a namespace. Create a new namespace and confirm it has noistio-injection label:
db namespace without injection:
--dry-run=client and save it to pod.yaml:
db namespace:
istio-proxy container and its configuration:
Manual injection (via
istioctl kube-inject) is useful when you cannot or do not want to label a namespace for automatic injection. Generate a YAML manifest with kubectl --dry-run=client -o yaml and run istioctl kube-inject -f pod.yaml | kubectl apply -f -.Quick reference — common commands
Summary
- Install
istioctland use it to install Istio into your cluster (istioctl install). - Enable automatic sidecar injection on a namespace with
kubectl label namespace <ns> istio-injection=enabled(replace<ns>with your namespace). - Restart or redeploy workloads created prior to labeling so the sidecar injector can modify their pod specs.
- Use
istioctl kube-inject -f pod.yaml | kubectl apply -f -to inject a sidecar into individual manifests for per-workload injection.
Links and references
- Istio Installation Guide
- istioctl reference
- Bookinfo sample manifests (Istio GitHub)
- Kubernetes kubectl documentation