DEV Community

Alex Spinov
Alex Spinov

Posted on

Istio Has a Free API — Service Mesh for Kubernetes with Zero Code Changes

Istio is the most popular service mesh for Kubernetes. It adds traffic management, security, and observability between your services — without changing a single line of application code.

Free, open source, CNCF graduated. Used by eBay, Airbnb, and Salesforce.

Why Use Istio?

  • Zero code changes — sidecar proxy handles everything
  • Traffic management — canary deployments, A/B testing, traffic splitting
  • mTLS everywhere — automatic mutual TLS between all services
  • Observability — distributed tracing, metrics, and access logs
  • Rate limiting — per-service or per-endpoint rate limits

Quick Setup

1. Install

istioctl install --set profile=demo
kubectl label namespace default istio-injection=enabled
Enter fullscreen mode Exit fullscreen mode

2. Traffic Splitting (Canary)

kubectl apply -f - <<EOF
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: my-app
spec:
  hosts: [my-app]
  http:
  - route:
    - destination:
        host: my-app
        subset: v1
      weight: 90
    - destination:
        host: my-app
        subset: v2
      weight: 10
EOF
Enter fullscreen mode Exit fullscreen mode

3. Check Proxy Status

# Proxy status for all pods
istioctl proxy-status

# Detailed config for specific pod
istioctl proxy-config routes deploy/my-app
istioctl proxy-config clusters deploy/my-app
Enter fullscreen mode Exit fullscreen mode

4. Kiali Dashboard (Observability)

istioctl dashboard kiali
# Opens service graph showing traffic flow between services
Enter fullscreen mode Exit fullscreen mode

5. Access Envoy Admin API

# Port-forward to a pod's sidecar
kubectl port-forward deploy/my-app 15000:15000

# Envoy stats
curl -s localhost:15000/stats | grep http

# Envoy clusters
curl -s localhost:15000/clusters | head -20

# Envoy config dump
curl -s localhost:15000/config_dump | jq '.configs | length'
Enter fullscreen mode Exit fullscreen mode

Python Example

from kubernetes import client, config

config.load_kube_config()
api = client.CustomObjectsApi()

# List VirtualServices
vs = api.list_namespaced_custom_object(
    group="networking.istio.io", version="v1beta1",
    namespace="default", plural="virtualservices")

for v in vs["items"]:
    print(f"VirtualService: {v['metadata']['name']}")
    for route in v['spec'].get('http', []):
        for dest in route.get('route', []):
            print(f"{dest['destination']['host']}:{dest['destination'].get('subset','default')} weight={dest.get('weight',100)}")
Enter fullscreen mode Exit fullscreen mode

Key Resources

Resource Description
VirtualService Traffic routing rules
DestinationRule Load balancing, circuit breaking
Gateway Ingress/egress config
PeerAuthentication mTLS settings
AuthorizationPolicy Access control
ServiceEntry External service registration

Need custom data extraction or scraping solution? I build production-grade scrapers for any website. Email: Spinov001@gmail.com | My Apify Actors

Top comments (0)