End of Sale Notice:
Commercial support for NGINX Service Mesh is available to customers who currently have active NGINX Microservices Bundle subscriptions. F5 NGINX announced the End of Sale (EoS) for the NGINX Microservices Bundles as of July 1, 2023.
See our End of Sale announcement for more details.
Deploy an Example App with NGINX Service Mesh
This topic provides a walkthrough of deploying an App with F5 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 F5 NGINX Service Mesh sidecar and make sure there are no overlaps with ports used by your applications.
Prerequisite
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.
Inject the Sidecar Proxy
You can use either automatic or manual injection to add the NGINX Service Mesh sidecar containers to your application pods.
Inject the Sidecar Proxy Automatically
To enable automatic sidecar injection for all Pods in a namespace, add the injector.nsm.nginx.com/auto-inject=enabled
label to the namespace.
kubectl label namespaces default injector.nsm.nginx.com/auto-inject=enabled
With auto-injection enabled, you can use kubectl
to apply your Deployment as normal.
The sidecar proxy will be added and 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 Observability
Check the Grafana dashboard
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:
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.
-
Port-forward your Prometheus Service:
kubectl -n <prometheus-namespace> port-forward svc/prometheus 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, DataDog, or LightStep.
-
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
http://localhost:16686
.