Modeling Environments with Linkerd Ingress (Part 1/3)

Overview, Setup, and a simple Use Case

Overview

Our Environment

The Calculator Service

Our Organization

Demo: Two Environment, each with Calculator Service integrated with KubeDNS

- name: GATEWAY_TOKENIZERSERVICE
value: http://tokenizer.team-tokenizer:80/tokenize
- name: GATEWAY_ADDITIONSERVICE
value: http://addition-operator.team-addition-operator:80/operate
- name: GATEWAY_SUBTRACTIONSERVICE
value: http://subtraction-operator.team-subtraction-operator:80/operate
- name: GATEWAY_MULTIPLICATIONSERVICE
value: http://multiplication-operator.team-multiplication-operator:80/operate
- name: GATEWAY_DIVISIONSERVICE
value: http://division-operator.team-division-operator:80/operate

Demo: Two Environments, each with the Calculator Service integrated with Linkerd

env:
- name: HTTP_PROXY
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: GATEWAY_TOKENIZERSERVICE
value: http://tokenizer/tokenize
- name: GATEWAY_ADDITIONSERVICE
value: http://addition-operator/operate
- name: GATEWAY_SUBTRACTIONSERVICE
value: http://subtraction-operator/operate
- name: GATEWAY_MULTIPLICATIONSERVICE
value: http://multiplication-operator/operate
- name: GATEWAY_DIVISIONSERVICE
value: http://division-operator/operate
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "multiplication-operator"
namespace: "team-multiplication-operator"
annotations:
kubernetes.io/ingress.class: "linkerd"
labels:
app: "multiplication-operator"
environment: "preprod"
spec:
rules:
- host: "multiplication-operator"
http:
paths:
- backend:
serviceName: "multiplication-operator"
servicePort: "my-http"
Linkerd Graph for the below ab. Tokenizer and Subtraction are called fewer times than the other operators.
# 1 + 6 + 7 * 2 / 1 * 99 - 72 / 100
ab -H "Host: gateway" -c 20 -n 500 172.17.4.3:1080/compute?equation=1%2B6%2B7%2A2%2F1%2A99%2D72%2F100

Use Case: Team-Multiplication-Operator wants to canary a new build in Pre-Production

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: "multiplication-operator-build-123"
namespace: "team-multiplication-operator"
annotations:
kubernetes.io/ingress.class: "linkerd"
labels:
app: "multiplication-operator-build-123"
environment: "preprod"
spec:
rules:
- host: "multiplication-operator-build-123"
http:
paths:
- backend:
serviceName: "multiplication-operator-build-123"
servicePort: "my-http"
/svc => /#/io.l5d.k8s ;
/split => /#/io.l5d.k8s ;
/svc/team-multiplication-operator/my-http/multiplication-operator => 1 * /split/team-multiplication-operator/my-http/multiplication-operator-build-123 & 8 * /split/team-multiplication-operator/my-http/multiplication-operator ;
See: https://linkerd.io/in-depth/routing/

From Static to Dynamic

$ namerctl dtab update web - <<EOF
/srv => /io.l5d.fs ;
/srv => /io.l5d.serversets/path/to/services ;
/host => /srv ;
/http/1.1/* => /host ;
/host/users => 1 * /srv/users-v2 & 99 * /srv/users ;
EOF
# link

Wrapping Up