Deploy sample apps
Deploy the Bookinfo, httpbin, and hello world sample apps.
These sample apps are used throughout the documentation to help test connectivity, such as in the traffic management, security, and resiliency policies guides.
Bookinfo
To test out microservice traffic management, deploy different versions of the Bookinfo sample app to both of the workload clusters. cluster1
runs the app with versions 1 and 2 of the reviews service (reviews-v1
and reviews-v2
), and cluster2
runs version 3 of the reviews service (reviews-v3
).
Get the revision that you used for your installation. Typically, this is
main
for a Helm installation, orgloo
for a Gloo operator installation.export REVISION=$(kubectl get pod -L app=istiod -n istio-system -o jsonpath='{.items[0].metadata.labels.istio\.io/rev}') echo ${REVISION}
Create the
bookinfo
namespace in each workload cluster, and label the namespaces for Istio injection so that the services become part of the service mesh.kubectl create ns bookinfo --context ${REMOTE_CONTEXT1} kubectl label ns bookinfo istio.io/rev=${REVISION} --overwrite --context ${REMOTE_CONTEXT1} kubectl create ns bookinfo --context ${REMOTE_CONTEXT2} kubectl label ns bookinfo istio.io/rev=${REVISION} --overwrite --context ${REMOTE_CONTEXT2}
Deploy Bookinfo with the
details
,productpage
,ratings
,reviews-v1
, andreviews-v2
services 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.24.3/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 # deploy all bookinfo service accounts kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.24.3/samples/bookinfo/platform/kube/bookinfo.yaml -l 'account' --context ${REMOTE_CONTEXT1}
Deploy Bookinfo with the
ratings
andreviews-v3
services in the second cluster.# deploy reviews and ratings services kubectl -n bookinfo apply -f https://raw.githubusercontent.com/istio/istio/1.24.3/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.24.3/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.24.3/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.24.3/samples/bookinfo/platform/kube/bookinfo.yaml -l 'account in (reviews, ratings)' --context ${REMOTE_CONTEXT2}
Verify that the Bookinfo app deployed successfully.
kubectl get pods,svc -n bookinfo --context ${REMOTE_CONTEXT1} kubectl get pods,svc -n bookinfo --context ${REMOTE_CONTEXT2}
httpbin
The httpbin sample app is a simple tool to test HTTP requests and responses. Unlike curl, you can see not only the response headers, but also the request headers.
Create an
httpbin
namespace incluster1
, and label the namespace for Istio injection so that the services in the namespace become part of the service mesh.kubectl create ns httpbin --context ${REMOTE_CONTEXT1} kubectl label ns httpbin istio.io/rev=main --overwrite=true --context ${REMOTE_CONTEXT1}
Deploy the httpbin app.
kubectl -n httpbin apply -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/httpbin.yaml --context ${REMOTE_CONTEXT1}
Verify that the httpbin app is running.
kubectl -n httpbin get pods --context ${REMOTE_CONTEXT1}
hello world
The hello world sample app is a simple way to test responses for different app versions. The following examples install two versions of hello world in one cluster, and two versions in the other workload cluster.
Create the
helloworld
namespace in each workload cluster, and label the namespaces for Istio injection so that the services become part of the service mesh.kubectl create ns helloworld --context ${REMOTE_CONTEXT1} kubectl label ns helloworld istio.io/rev=main --overwrite=true --context ${REMOTE_CONTEXT1} kubectl create ns helloworld --context ${REMOTE_CONTEXT2} kubectl label ns helloworld istio.io/rev=main --overwrite=true --context ${REMOTE_CONTEXT2}
Deploy hello world v1 and v2 to
cluster1
.kubectl -n helloworld apply --context ${REMOTE_CONTEXT1} -l 'service=helloworld' -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/helloworld.yaml kubectl -n helloworld apply --context ${REMOTE_CONTEXT1} -l 'app=helloworld,version in (v1, v2)' -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/helloworld.yaml
Deploy hello world v3 and v4 to
cluster2
.kubectl -n helloworld apply --context ${REMOTE_CONTEXT2} -l 'service=helloworld' -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/helloworld.yaml kubectl -n helloworld apply --context ${REMOTE_CONTEXT2} -l 'app=helloworld,version in (v3, v4)' -f https://raw.githubusercontent.com/solo-io/gloo-mesh-use-cases/main/policy-demo/helloworld.yaml
Verify that the hello world apps are running.
kubectl -n helloworld get pods --context ${REMOTE_CONTEXT1} kubectl -n helloworld get pods --context ${REMOTE_CONTEXT2}
Other service namespaces
For any other namespaces that you want to deploy apps to, be sure to follow these steps to include your services in the service mesh.
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.
Get the revision that you used for your installation. Typically, this is
main
for a Helm installation, orgloo
for a Gloo operator installation.export REVISION=$(kubectl get pod -L app=istiod -n istio-system -o jsonpath='{.items[0].metadata.labels.istio\.io/rev}') echo ${REVISION}
Label the service namespace for Istio sidecar injection with the revision label.
kubectl label namespace <namespace> istio.io/rev=${REVISION} --overwrite
If 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>