Deploy an Example App with NGINX Service Mesh
This topic provides a walkthrough of deploying an App with NGINX Service Mesh.
Overview
In this tutorial, we will use the bookinfo
example app Deployment.
Note:
Notice in the above yaml:
- All of the service spec port names are populated with the name of the protocol
- All deployment
containerPort
fields 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.
Note:
Review the ports reserved by NGINX Service Mesh sidecar and make sure there are no overlaps with ports used by your applications.
Inject the Sidecar Proxy
You can use either automatic injection or manual injection to add the NGINX Service Mesh sidecar containers to your application pods.
Tip:
- Automatic proxy injection (enabled by default)
- Manual proxy injection
Inject the Sidecar Proxy Automatically
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
Inject the Sidecar Proxy Manually
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 kubectl
:
nginx-meshctl inject < examples/bookinfo.yaml | kubectl apply -f -
Verify that the Sample App Works Correctly
-
Port-forward to the
productpage
service:kubectl port-forward svc/productpage 9080
-
Open the Service URL in a browser:
http://localhost:9080
. -
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.
Verify NGINX Service Mesh Features
Important:
In version 1.5, NGINX Service Mesh won’t deploy Grafana, Prometheus, or any tracing servers for you anymore. Refer to the Monitoring and Tracing guide for instructions on using your own servers with NGINX Service Mesh.
Check the Grafana dashboard
Grafana is the observability dashboard used to visualize Prometheus metrics for applications in NGINX Service Mesh.
-
Find the name of the Grafana pod:
kubectl -n nginx-mesh get pods
-
Port-forward to the pod:
kubectl -n nginx-mesh port-forward <grafana pod name> 3000
-
Open the Grafana URL in a browser:
http://localhost:3000
.
Check Prometheus metrics
Prometheus is the systems monitoring tool used to collect metrics, such as request time and success rate, from applications in NGINX Service Mesh.
-
Find the name of the Prometheus pod:
kubectl -n nginx-mesh get pods
-
Port-forward to the pod:
kubectl -n nginx-mesh port-forward <prometheus pod name> 9090
-
Open the Prometheus server URL in a browser window:
http://localhost:9090/graph
Check Tracing
Tracing is used to track and profile requests as they pass through applications, and is collected using services such as Jaeger, Zipkin, or DataDog.
-
Find the name of the tracing pod:
kubectl -n nginx-mesh get pods
-
Port-forward to the pod:
kubectl -n nginx-mesh port-forward <tracing pod name> <tracing-pod-port>
-
Open the tracing server URL in a browser. For example, you might access the Jaeger server at
http://localhost:16686
.