This repository contains all resources that are required to test the canary feature of NGINX Ingress Controller.
- Kubernetes cluster
- NGINX Ingress Controller 0.21.0+
First of all, change the host definition in the ingress manifests deploy/prod-ingress.yaml and deploy/canary-ingress.yaml from canary-demo.example.com to your URL
Roll-out the stable version 1.0.0 to the cluster
$ make step-1
Execute the following commands to send n=1000 requests to the endpoint
$ ab -n 1000 -c 100 -s 60 "http://<your_URL>/version"
$ curl -s "http://<your_URL>/metrics" | jq '.calls'
If everything is working as expected, the curl command should return "1000".
Send GET requests to /reset endpoint to set the request counter to zero
$ curl "http://<your_URL>/reset"
Push the new software version 1.0.1 as a canary deployment to the cluster
$ make step-2
Again, start sending traffic to the endpoint
$ ab -n 1000 -c 100 -s 60 "http://<your_URL>/version"
Do a port forward to each of the pods to check the request count
$ kubectl -n demo-prod port-forward <pod-name> 8080:8080
$ curl -s http://localhost:8080/metrics | jq '.calls'
$ kubectl -n demo-prod port-forward <pod-name> 8081:8080
$ curl -s http://localhost:8081/metrics | jq '.calls'
Unless the weight has been changed to a different value, you should see approximately 800 requests being served by the production deployment and the remainig 200 by the canary.
Remove all resource from the cluster
$ make clean-up