I'm trying to create a demo of a service mesh using Kuma, and I'm confused about how to configure a traffic traffic split when viewing the example in the docs. I have two versions of a microservice which return different results depending on an environment variable which is defined in the Kubernetes config. And the service associated with the pods is configured by its config which pod to use (not sure if this the right way to do this):
apiVersion: v1
kind: Pod
metadata:
name: dntapi-mil
namespace: meshdemo
labels:
uservice: dntapi
format: military
spec:
containers:
- name: dntapi
image: meshdemo:dntapi
ports:
- name: http
containerPort: 4000
env:
- name: MILITARY
value: "true"
---
apiVersion: v1
kind: Pod
metadata:
name: dntapi-std
namespace: meshdemo
labels:
uservice: dntapi
format: standard
spec:
containers:
- name: dntapi
image: meshdemo:dntapi
ports:
- name: http
containerPort: 4000
env:
- name: MILITARY
value: "false"
---
apiVersion: v1
kind: Service
metadata:
name: dntapi
namespace: meshdemo
spec:
selector:
uservice: dntapi
format: military
ports:
- protocol: TCP
port: 4000
targetPort: 4000
This works from a purely K8s perspective if I change the selector on the service, but looking at the Kuma example of split traffic:
conf:
split:
- weight: 90
destination:
kuma.io/service: redis_default_svc_6379
version: '1.0'
- weight: 10
destination:
kuma.io/service: redis_default_svc_6379
version: '2.0'
To what is "version" referring when associated with the service (and I have to admit that I don't understand how there could be two services with the same identifier). Are these K8s selectors?
I should add that when I inspect services with kumactl, I see two for this microservice, one without a port name:
dntapi-std_meshdemo_svc Online 1/1
dntapi_meshdemo_svc_4000 Online 1/1
Thanks in advance.