Deploy an Example 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.

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.

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

  1. Port-forward to the productpage service:

    kubectl port-forward svc/productpage 9080
    
  2. Open the Service URL in a browser: http://localhost:9080.

  3. 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

Check the Grafana dashboard

Grafana is the observability dashboard used to visualize Prometheus metrics for applications in NGINX Service Mesh.

  1. Find the name of the Grafana pod:

    kubectl -n nginx-mesh get pods
    
  2. Port-forward to the pod:

    kubectl -n nginx-mesh port-forward <grafana pod name> 3000
    
  3. 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.

  1. Find the name of the Prometheus pod:

    kubectl -n nginx-mesh get pods
    
  2. Port-forward to the pod:

    kubectl -n nginx-mesh port-forward <prometheus pod name> 9090
    
  3. 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.

  1. Find the name of the tracing pod:

    kubectl -n nginx-mesh get pods
    
  2. Port-forward to the pod:

    kubectl -n nginx-mesh port-forward <tracing pod name> <tracing-pod-port>
    
  3. Open the tracing server URL in a browser. For example, you might access the Jaeger server at http://localhost:16686.