Quickstart
- Kubernetes 1.11+
- CoreDNS installed as (versions 1.3+ supported)
- Helm v3
Depending on the tool you used to deploy your cluster you might need to tweak RBAC permissions.
kubeadm
If you used to deploy your cluster, a fast way to allow the helm installation to perform all steps it needs is to edit the cluster-admin
ClusterRoleBinding
, adding the following to the subjects
section:
Command
helm repo add maesh https://containous.github.io/maesh/charts
helm repo update
helm install maesh maesh/maesh
Expected output
[...]
NOTES:
Thank you for installing maesh.
Your release is named maesh.
To learn more about the release, try:
$ helm status maesh
$ helm get maesh
As an example, let’s deploy a server application and a client application under the maesh-test
namespace.
server.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: server
namespace: maesh-test
app: server
spec:
replicas: 2
selector:
matchLabels:
template:
metadata:
labels:
app: server
spec:
containers:
- name: server
image: containous/whoami:v1.4.0
ports:
- containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: server
namespace: maesh-test
spec:
selector:
app: server
ports:
- name: web
protocol: TCP
port: 80
Create the namespace then deploy those two applications:
kubectl create namespace maesh-test
kubectl apply -f server.yaml
kubectl apply -f client.yaml
You should now see the following output:
Command
kubectl get all -n maesh-test
Expected output
NAME READY STATUS RESTARTS AGE
pod/client-7446fdf848-x96fq 1/1 Running 0 79s
pod/server-7c8fd58db5-sd4f9 1/1 Running 0 77s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/server ClusterIP 10.43.17.247 <none> 80/TCP 77s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/client 1/1 1 1 79s
deployment.apps/server 2/2 2 2 77s
NAME DESIRED CURRENT READY AGE
replicaset.apps/client-7446fdf848 1 1 1 79s
replicaset.apps/server-7c8fd58db5 2 2 2 77s
Take note of the client app pod name (here it’s client-7446fdf848-x96fq
) and open a new terminal session inside this pod using kubectl exec
.
From inside the client container, make sure your server is reachable using the Kubernetes DNS service discovery.
curl server.maesh-test.svc.cluster.local
Expected Output
Hostname: server-7c8fd58db5-sd4f9
IP: 127.0.0.1
IP: ::1
IP: 10.42.2.10
IP: fe80::a4ec:77ff:fe37:1cdd
RemoteAddr: 10.42.2.9:46078
GET / HTTP/1.1
Host: server.maesh-test.svc.cluster.local
User-Agent: curl/7.64.0
You can note that all this server application is doing is to respond with the content of the request it receives.
Now replace the svc.cluster.local
suffix by maesh
, and tada: you are now using Maesh to reach your server!
Command
curl server.maesh-test.maesh
Expected Output
Note the presence of X-Forwarded
headers as well as other instrumentation headers like Uber-Trace-Id
, indicating than your request has been processed and instrumented by Maesh.