Service Mesh Basics
This page is a hands-on introduction to service meshes on Kubernetes: what the moving parts are, how to install one, and how to turn on mTLS and traffic routing.
Search across all documentation pages
This page is a hands-on introduction to service meshes on Kubernetes: what the moving parts are, how to install one, and how to turn on mTLS and traffic routing.
It also frames the real question - when mesh complexity pays off versus just using Ingress and NetworkPolicy.
kubectl matching your cluster's minor version.Quick install of the Linkerd CLI on macOS or Linux:
# Install the Linkerd CLI, then verify the cluster is ready
curl -fsSL https://run.linkerd.io/install | sh
export PATH=$PATH:$HOME/.linkerd2/bin
linkerd check --preBefore installing anything, list your services and ask what the mesh would do for you.
kubectl get deploy -A --no-headers | wc -l
kubectl get networkpolicy -AInstall the control plane after validating prerequisites.
linkerd install --crds | kubectl apply -f -
linkerd install | kubectl apply -f -
linkerd checklinkerd install --crds applies custom resource definitions first; the second command installs the control plane.linkerd check validates certificates, control-plane health, and API access.linkerd namespace.Meshing is controlled by an annotation.
apiVersion: v1
kind: Namespace
metadata:
name: payments
annotations:
linkerd.io/inject: enabledkubectl rollout restart deploy -n payments to inject them.With injected pods, traffic between them is automatically mutually authenticated and encrypted.
linkerd viz install | kubectl apply -f -
linkerd viz edges deployment -n paymentsedges command shows which connections are mTLS-secured.Istio offers both sidecar and sidecar-less ambient modes.
istioctl install --set profile=ambient -y
kubectl label namespace payments istio.io/dataplane-mode=ambientambient profile installs node-level ztunnel proxies for L4 mTLS.A mesh governs east-west traffic; you still terminate external traffic at the edge.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: web
namespace: payments
spec:
parentRefs:
- name: public-gateway
rules:
- backendRefs:
- name: web
port: 80Every sidecar consumes resources, so measure before and after.
kubectl top pods -n paymentsAn L7 mesh routes by weight without redeploying either version.
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: reviews
namespace: payments
spec:
hosts:
- reviews
http:
- route:
- destination:
host: reviews
subset: v1
weight: 90
- destination:
host: reviews
subset: v2
weight: 10v2 for a canary.Lock down which workloads may call a service at L7.
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
name: reviews-allow-web
namespace: payments
spec:
selector:
matchLabels:
app: reviews
action: ALLOW
rules:
- from:
- source:
principals:
- "cluster.local/ns/payments/sa/web"The mesh gives you resilience controls; use them carefully.
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: reviews-resilience
namespace: payments
spec:
hosts:
- reviews
http:
- timeout: 2s
retries:
attempts: 2
perTryTimeout: 500ms
route:
- destination:
host: reviewsStack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Reviewed by Chris St. John·Last updated Jul 16, 2026