Add apps to the service mesh
Add services in existing namepaces to your service mesh, or deploy the Bookinfo sample app to try out traffic routing in your service mesh.
Service namespaces
Now that Istio is up and running, you can create service namespaces for your teams to run app workloads in. For any namespaces that you want to deploy apps to, be sure to follow these steps to include your services in the service mesh.
Save the revision that you used for your istiod installation in an environment variable. Typically, this is
mainfor a Helm installation, orgloofor a Gloo Operator installation.- Gloo Operator:
export REVISION=gloo - Helm:
export REVISION=main
- Gloo Operator:
Label the service namespace for Istio sidecar injection with the revision label.
kubectl label namespace <namespace> istio.io/rev=${REVISION} --overwriteIf you already deployed app pods to the namespace, restart the workloads so that sidecars are injected into the pods. For example, you might roll out a restart to each deployment by using a command similar to the following.
kubectl rollout restart deployment -n <namespace> <deployment>
Bookinfo example
For testing purposes, you can deploy Bookinfo, the Istio sample app, and add it to your service mesh.
Single cluster
Save the revision that you used for your istiod installation in an environment variable. Typically, this is
mainfor a Helm installation, orgloofor a Gloo Operator installation.- Gloo Operator:
export REVISION=gloo - Helm:
export REVISION=main
- Gloo Operator:
Create the
bookinfonamespace and label it so that the services become part of the service mesh.kubectl create ns bookinfo kubectl label ns bookinfo istio.io/rev=${REVISION} --overwriteDeploy the Bookinfo app.
# deploy bookinfo application components for all versions less than v3 kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'app,version notin (v3)' # deploy an updated product page with extra container utilities such as 'curl' and 'netcat' kubectl -n bookinfo apply -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/productpage-with-curl.yaml # deploy all bookinfo service accounts kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'account'Verify that the Bookinfo app deployed successfully.
kubectl get pods,svc -n bookinfo
Multicluster
Save the revision that you used for your istiod installation in an environment variable. Typically, this is
mainfor a Helm installation, orgloofor a Gloo Operator installation.- Gloo Operator:
export REVISION=gloo - Helm:
export REVISION=main
- Gloo Operator:
Create the
bookinfonamespace in each cluster, and label them with theistio.io/rev=$REVISIONlabel. This label adds all Bookinfo services that you create in each namespace to the sidecar mesh in the respective cluster.for context in ${REMOTE_CONTEXT1} ${REMOTE_CONTEXT2}; do kubectl --context ${context} create ns bookinfo kubectl --context ${context} label namespace bookinfo istio.io/rev=${REVISION} --overwrite doneDeploy Bookinfo with the
details,productpage,ratings,reviews-v1, andreviews-v2services in the first cluster.# deploy bookinfo application components for all versions less than v3 kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'app,version notin (v3)' --context ${REMOTE_CONTEXT1} # deploy an updated product page with extra container utilities such as 'curl' and 'netcat' kubectl -n bookinfo apply -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/productpage-with-curl.yaml --context ${REMOTE_CONTEXT1} # deploy all bookinfo service accounts kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'account' --context ${REMOTE_CONTEXT1}Deploy Bookinfo with the
ratingsandreviews-v3services in the second cluster.# deploy reviews and ratings services kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'service in (reviews)' --context ${REMOTE_CONTEXT2} # deploy reviews-v3 kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'app in (reviews),version in (v3)' --context ${REMOTE_CONTEXT2} # deploy ratings kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'app in (ratings)' --context ${REMOTE_CONTEXT2} # deploy reviews and ratings service accounts kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.28.0/samples/bookinfo/platform/kube/bookinfo.yaml -l 'account in (reviews, ratings)' --context ${REMOTE_CONTEXT2}Verify that the Bookinfo app is deployed successfully.
kubectl --context ${REMOTE_CONTEXT1} get pods,svc -n bookinfo kubectl --context ${REMOTE_CONTEXT2} get pods,svc -n bookinfo
Next
- For multicluster environments, deploy east-west gateways to your clusters.
- Launch the Gloo UI to review the Istio insights that were captured for your service mesh setup. Gloo Mesh (Gloo Platform APIs) comes with an insights engine that automatically analyzes your Istio setups for health issues. These issues are displayed in the UI along with recommendations to harden your Istio setups. The insights give you a checklist to address issues that might otherwise be hard to detect across your environment. For more information, see Insights.
- Monitor and observe your Istio environment with Gloo Mesh (Gloo Platform APIs)’s built-in telemetry tools.
- When it’s time to upgrade your service mesh, you can perform a safe in-place upgrade by using the Gloo Operator or Helm.