Istio has the ability to install itself as a sidecar automatically by using labels in the namespace. We can make it function in this way by using the following steps:
- Let's label the default namespace with the appropriate label, namely, istio-injection=enabled:
kubectl label namespace default istio-injection=enabled
- Let's launch an application to see whether the sidecar is indeed deployed automatically:
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
- Get the pods running on the default namespace:
kubectl get pods
- Run the describe command on any one of the pods:
kc describe pods/details-<pod id>
You can see that the sidecar has indeed been applied:
Name: details-v1-7bcdcc4fd6-xqwjz
Namespace: default
...
Labels: app=details
pod-template-hash=3678770982
version=v1
Annotations: sidecar.istio.io/status:
{"version":"887285bb7fa76191bf7f637f283183f0ba057323b078d44c3db45978346cbc1a","initContainers":["istio-init"],"containers":["istio-proxy"]...
...
Note that without making any modifications to the underlying application, we were able to get the istio service mesh deployed and attached to the containers.