Skip to main content
This guide demonstrates how to install Istio into a Kubernetes cluster using the 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 kubectl is configured and can access your cluster.
  • Choose an Istio release (this lesson uses 1.26.3). Keep your istioctl client 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):
Describe a pod (example: 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 the istioctl client:
Download the chosen Istio release (example: 1.26.3) and add istioctl to your PATH:
Verify the client is available and that Istio is not yet installed in the cluster:
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 the demo profile for an easier, feature-rich setup suitable for demos and labs:
Confirm 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:
Label the default namespace to enable automatic sidecar injection:
Re-run the analyzer. It will warn about existing pods that were created before the namespace was labeled and are therefore missing the proxy:
Since automatic injection is applied at pod creation time, restart or redeploy any existing workloads so the injector can add the istio-proxy. One simple way is to do a rollout restart for the relevant deployments:
After restarting, the affected pods should show two containers (application + istio-proxy). The terminal screenshot below demonstrates the change from 1/1 to 2/2 for injected pods.
The image shows a terminal displaying the status of Kubernetes pods and deployments, with commands such as kubectl get pods and kubectl get deployments.apps being executed.
Verify pods and deployments:
Describe a restarted pod to see the added 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:
After reapplying, pods will be created in the labeled 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 no istio-injection label:
Run a Redis pod in the db namespace without injection:
Prepare a manifest for a second Redis pod using --dry-run=client and save it to pod.yaml:
Inject the Istio sidecar into that manifest and create the pod:
Verify both pods in the db namespace:
Describe the manually injected pod to confirm the 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 istioctl and 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.
This concludes the demo of installing Istio via the CLI and injecting sidecars both automatically and manually.

Watch Video

Practice Lab