> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploying our First Application on Istio

> Guide to deploy Bookinfo on Istio, enable namespace automatic sidecar injection, label namespace, and re-deploy pods so Envoy sidecar proxies are added to each pod.

This guide shows how to deploy the Bookinfo sample application onto Istio Service Mesh and enable automatic sidecar injection for the namespace so Envoy proxies are added to each pod.

![A presentation slide titled "Deploying Our First Application With Istio" with a dark blue curved panel on the right featuring a browser-window icon and a plus symbol.](https://mintcdn.com/kodekloud-c4ac6d9a/UK3oaG81L_yXeDcP/images/Kubernetes-and-Cloud-Native-Associate-KCNA/Container-Orchestration-Service-Mesh/Deploying-our-First-Application-on-Istio/istio-deploy-first-application-slide.jpg?fit=max\&auto=format\&n=UK3oaG81L_yXeDcP\&q=85\&s=22a11209592aa212ecb48a4b48ddfe8f)

Overview

* Deploy the Bookinfo sample application.
* Verify pods and check whether Envoy sidecars are injected.
* If sidecars are missing, enable automatic injection for the namespace and re-deploy.

Deploy the Bookinfo sample application (from the official Istio samples repository):

```bash theme={null}
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
```

Typical output will list multiple Deployments and Services being created, for example:

```bash theme={null}
deployment.apps/details-v1 created
deployment.apps/ratings-v1 created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
deployment.apps/productpage-v1 created
...
```

Check pod status across namespaces:

```bash theme={null}
kubectl get pods -A
```

Example output showing only the application containers (no Envoy sidecars yet):

```bash theme={null}
NAMESPACE   NAME                                   READY   STATUS    RESTARTS   AGE
default     details-v1-66b6955995-zgrd8            1/1     Running   0          6m57s
default     productpage-v1-5d9b4c9849-dckrt        1/1     Running   0          6m57s
default     ratings-v1-fd78f799f-s94cc             1/1     Running   0          6m58s
default     reviews-v1-6549ddccc5-bxv4n            1/1     Running   0          6m58s
default     reviews-v2-76c4865449-2qmhj            1/1     Running   0          6m58s
default     reviews-v3-6b554c875-vbf8v             1/1     Running   0          6m58s
```

Note the READY column values are `1/1`, meaning each pod has only the application container. This indicates automatic sidecar injection did not occur in the namespace where the pods were created.

Diagnose missing sidecar injection using istioctl:

```bash theme={null}
istioctl analyze
```

A common diagnostic result:

```text theme={null}
Info [IST0102] (Namespace default) The namespace is not enabled for Istio injection.
Run 'kubectl label namespace default istio-injection=enabled' to enable it, or
'kubectl label namespace default istio-injection=disabled' to explicitly mark it as
not needing injection.
```

Why this happens

* Istio performs automatic sidecar injection at the namespace level. If the namespace is not labeled for injection, newly created pods in that namespace will not receive injected Envoy proxies.
* Labeling gives you control over which namespaces are part of the mesh (for example, you may want Istio enabled for application namespaces such as `hr` or `payroll` but not for `kube-system`).

Enable automatic sidecar injection for the `default` namespace:

```bash theme={null}
kubectl label namespace default istio-injection=enabled
```

Verify the label is applied:

```bash theme={null}
kubectl get namespace -L istio-injection
```

Example output showing the label:

```bash theme={null}
NAME      STATUS   AGE     istio-injection
default   Active   10m     enabled
```

Label changes apply only to pods created after the label is set. To have existing pods receive an Envoy sidecar, they must be restarted or re-created (for example, delete and re-deploy the resources).

Because the original Bookinfo pods were created before enabling injection, delete the Bookinfo resources and re-deploy so the new pods will receive Envoy sidecars:

```bash theme={null}
kubectl delete -f samples/bookinfo/platform/kube/bookinfo.yaml
```

Example (truncated):

```bash theme={null}
service "details" deleted
serviceaccount "bookinfo-details" deleted
...
```

Re-deploy the Bookinfo sample:

```bash theme={null}
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
```

Verify pods now include both the application container and the Envoy sidecar:

```bash theme={null}
kubectl get pods
```

You should now see READY values of `2/2`, indicating two containers per pod (application + Envoy):

```bash theme={null}
NAME                                   READY   STATUS    RESTARTS   AGE
details-v1-5f449bdbb9-vrgzh            2/2     Running   0          26s
productpage-v1-6f9df695b7-cx259        2/2     Running   0          26s
ratings-v1-857bb87c57-hmpfd            2/2     Running   0          26s
reviews-v1-68f9c47f69-cbj7c            2/2     Running   0          26s
reviews-v2-5d56c488f5-wb4v7            2/2     Running   0          26s
reviews-v3-869ff44845-h5fpf            2/2     Running   0          26s
```

Conclusion

* After labeling the namespace for Istio injection and re-creating the pods, Envoy sidecar proxies will be injected automatically and your Bookinfo application becomes part of the service mesh.
* For more details, see the Istio documentation: [Istio diagnostic tools — istioctl analyze](https://istio.io/latest/docs/ops/diagnostic-tools/istioctl-analyze/) and the Bookinfo sample in the Istio repository: [samples/bookinfo/platform/kube](https://github.com/istio/istio/tree/master/samples/bookinfo/platform/kube).

Command quick reference

| Action | Command |
| - | - |
| Deploy Bookinfo sample | `kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml` |
| List pods (all namespaces) | `kubectl get pods -A` |
| Diagnose Istio issues | `istioctl analyze` |
| Enable namespace injection | `kubectl label namespace default istio-injection=enabled` |
| Show namespace labels | `kubectl get namespace -L istio-injection` |
| Delete Bookinfo resources | `kubectl delete -f samples/bookinfo/platform/kube/bookinfo.yaml` |

> **[Watch Video](https://learn.kodekloud.com/user/courses/kubernetes-and-cloud-native-associate-kcna/module/aeecda11-7f2e-48c5-9c54-5409f2d9d8d8/lesson/c4314805-bc44-4627-a948-b00e1b189e94)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.