Welcome to a sample application that demonstrates the Kuma service mesh in action. Kuma is designed to work across Kubernetes and VMs environments, with support for multi-zone deployments across many different clusters, data centers, and clouds.
To learn more about Kuma, see the Kuma docs.
Kuma is a CNCF Sandbox project.
The application consists of two services:
- A
demo-app
service that presents a web application that allows us to increment a numeric counter - A
redis
service that stores the counter
The demo-app
service presents a browser interface that listens on port 5000
. When it starts, it expects to find a zone
key in Redis that specifies the name of the datacenter (or cluster) that the current redis
instance belongs to. This name is then displayed in the demo-app
GUI.
The zone
key is purely static and arbitrary, but by having different zone
values across different redis
instances, we know at any given time from which Redis instance we are fetching/incrementing our counter when we route across a distributed environment across many zones, clusters and clouds.
To run the kuma-counter-demo
follow one of these guides:
We can configure the following environment variables when running demo-app
:
REDIS_HOST
: Determines the hostname to use when connecting to Redis. Default is127.0.0.1
.REDIS_PORT
: Determines the port to use when connecting to Redis. Default is6379
.APP_VERSION
: Lets you change the version number displayed in the main page ofdemo-app
. Default is1.0
.APP_COLOR
: Lets you change background color of thedemo-app
main page. Default is#FAFAFA
.IP_VERSION
: Lets you change the IP family version to use when connecting to Redis. Default is4
for IPv4, with the option to set as6
for IPv6.
The APP_VERSION
and APP_COLOR
environment variables are handy when we want to create different versions of demo-app
and get immediate visual feedback when routing across them.
To add delay to response you need to set header x-set-response-delay-ms
. Example:
curl localhost:5001/increment -XPOST -H "x-set-response-delay-ms: 5000"
To enforce response status code you need to set header x-set-response-status-code
. Example:
curl localhost:5001/increment -XPOST -H "x-set-response-status-code: 503"