Deploy an Example App with NGINX Service Mesh
This topic provides a walkthrough of deploying an App with NGINX Service Mesh.
In this tutorial, we will use the
bookinfo example app Deployment.
Notice in the above yaml:
- All of the service spec port names are populated with the name of the protocol
- All deployment
containerPortfields are specified.
This is used in the mesh to identify the kind of traffic being sent and where it is allowed to be received. For more information on deployment and service identification rules, see identification-rules in the Getting Started section.
Review the ports reserved by NGINX Service Mesh sidecar and make sure there are no overlaps with ports used by your applications.
Ensure that you have deployed Prometheus, Grafana, and a tracing backend and configured NGINX Service Mesh to export data to them. Refer to the Monitoring and Tracing guide for instructions.
You can use either automatic injection or manual injection to add the NGINX Service Mesh sidecar containers to your application pods.
Since NGINX Service Mesh uses automatic injection by default, you just need to use
kubectl to apply your Deployment.
The sidecar proxy runs automatically.
kubectl apply -f examples/bookinfo.yaml
You can inject the sidecar proxy into your Deployment manually by using the
nginx-meshctl inject CLI command.
You can then
kubectl apply the Deployment as usual, or pipe the command directly to
nginx-meshctl inject < examples/bookinfo.yaml | kubectl apply -f -
Port-forward to the
kubectl port-forward svc/productpage 9080
Open the Service URL in a browser:
Click one of the links to view the app as a general user, then as a test user, and verify that all portions of the page load.
Grafana is the observability dashboard used to visualize Prometheus metrics for applications in NGINX Service Mesh.
Port-forward your Grafana Service:
kubectl -n <grafana-namespace> port-forward svc/grafana 3000
Open the Grafana URL in a browser:
Prometheus is the systems monitoring tool used to collect metrics, such as request time and success rate, from applications in NGINX Service Mesh.
Port-forward your Prometheus Service:
kubectl -n <prometheus-namespace> port-forward svc/prometheus 9090
Open the Prometheus server URL in a browser window:
Port-forward your tracing Service:
kubectl -n <tracing-namespace> port-forward svc/<tracing-service> <tracing-service-port>
Open the tracing server URL in a browser. For example, you might access the Jaeger server at