Zalando Skipper Documentation

repository·master·Indexed 25 days ago

https://github.com/zalando/skipper

A high-performance HTTP router and reverse proxy designed for service composition. Skipper supports over 300,000 route definitions with complex lookup conditions, extensible request processing filters, and the eskip routing language. It can be deployed as a Kubernetes Ingress controller, an authentication proxy, or a standalone binary. The project also includes pathmux for effective tree lookup with wildcard matching and a Base64 script module for GopherLua.

Tokens
75.3K
Snippets
193
Records
420
Agent score
82%

What's inside Skipper

  1. Overview of pathmux tree lookup

    master

    Pathmux is a package for effective tree lookup with wildcard matching. It is a fork of httptreemux that exposes the internal tree lookup interface and removes HTTP-specific wrappers.

    Use pathmux instead of httptreemux if you need to:

    • Store a large number of custom objects in a lookup tree keyed by path values.
    • Use the backtracking feature to refine wildcard matching evaluation using custom logic (instructing the lookup to continue searching the tree if a matched object does not meet specific custom conditions).
  2. Overview of Skipper

    master
    Skipper is an HTTP router and reverse proxy designed for service composition. It is optimized to handle large-scale routing environments, supporting over 300,000 HTTP route definitions with detailed lookup conditions. It allows for flexible augmentation of the request flow through the use of filters. Skipper can be used with its default configuration or extended via custom lookup logic, custom filters, and various configuration sources.
  3. Overview of Skipper HTTP Router and Reverse Proxy

    master
    Skipper is an HTTP router and reverse proxy designed for service composition. It is optimized to handle massive amounts of dynamically configured HTTP route definitions (exceeding 800,000 routes) and supports detailed lookup conditions. Users can extend Skipper with custom lookup logic, filters, and various configuration sources.
  4. Understand Skipper's Scalability and Performance

    master

    Skipper is designed for high-throughput environments and scales linearly with the number of CPUs.

    Performance Characteristics:

    • Overhead: Can run with sub-millisecond overhead.
    • Routing Efficiency: Uses a tree search algorithm to reduce the number of routes scanned for a match, followed by predicate matching to find the best route.
    • Route Capacity: Capable of efficient routing for up to 500,000 routes (as a standalone proxy) and handles 15,000+ routes in Kubernetes Ingress controller configurations.
    • Configuration Updates: Uses dataclients to feed rebuilt routing trees. The tree is rebuilt every 3 seconds, making Kubernetes Ingress configuration changes quasi-instant.
  5. Understand Skipper's core binaries and components

    master

    Skipper is distributed as both a library and a multi-binary project consisting of two main components:

    • skipper: The HTTP proxy that handles request routing, filtering, and backend communication.
    • eskip: A CLI application used to verify, print, update, or delete Skipper routes.

    Internally, the skipper package connects to various dataclient sources (such as static files or Kubernetes ingress objects) to populate the proxy package's routing table.

  6. Understand Skipper Architecture

    master

    Skipper is an HTTP proxy designed for high-performance routing. It consists of two main binaries:

    • skipper: The HTTP proxy itself.
    • eskip: A CLI application used to verify, print, update, or delete Skipper routes.

    Internally, the skipper package uses dataclients to pull route information from sources like local files or Kubernetes ingress objects. The proxy package maintains a routing table that is replaced whenever routes change. Skipper supports Opentracing API (e.g., Jaeger) and exposes metrics in JSON and Prometheus formats.

  7. Understand the RouteGroup CRD Proposal

    master

    The RouteGroup Custom Resource Definition (CRD) is proposed to allow configuring Skipper in Kubernetes more effectively. It aims to group dependent routes into a single object to enable atomic updates and reduce complexity compared to using standard Kubernetes Ingress objects.

    Key benefits include:

    • Atomic Updates: Orchestrate traffic switching (e.g., via stackset-controller) for a full set of routes simultaneously, avoiding non-atomic changes across multiple Ingress objects.
    • Simplified Redirects: Avoid the need for multiple Ingress objects or the unsafe use of zalando.org/skipper-routes (which uses unvalidated eskip syntax strings).
    • Complex Traffic Switching: Support traffic switching (like A/B testing with cookie-based routing) that requires multiple Ingress objects to act as a single stackset.
    • DRY Configuration: Separates hosts and backends from specific path rules, making the configuration more maintainable.
    • Advanced Routing Support: Better integration for controllers (like OpenAPI spec controllers) that need to apply Skipper predicates and filters across a group of routes.
  8. Understand Skipper as a Kubernetes Ingress Controller

    master

    Skipper acts as an Ingress Controller by serving HTTP requests into a Kubernetes cluster. It is designed for rapidly changing routing trees and provides advanced resiliency and deployment features such as ratelimiting, circuit breakers, blue-green deployments, and shadow traffic.

    Deployment patterns:

    • Cloud: Deploy Skipper behind a cloud load balancer (e.g., AWS ALB or NLB).
    • Baremetal: Deploy Skipper behind a hardware/software load balancer, treating all Skipper instances as members of a single pool.

    To manage DNS entries pointing to your load balancer, it is recommended to use tools like external-dns.

  9. Understand Skipper Filter Chains and Context

    master

    Filters modify requests (before backend) or responses (after backend) in a pipeline.

    • Filter Chain: Request-phase filters run in definition order. Response-phase filters run in reverse order.
    • Filter Context: A request-scoped state shared among filters. It provides access to the request, response, metrics, tracer, logger, state bag, path params, and loopback/serve controls.
    • State Bag: A map[string]interface{} within the Filter Context used to share data between filters in the same request/response cycle.
  10. Understand Skipper Predicates and Route Matching

    master

    Predicates are conditions used to decide which route handles an incoming request. A request matches a route only if all predicates within that route evaluate to true.

    Example route with multiple predicates:

    all: Host(/^my-host-header\.example\.org$/) && Method("GET") && Path("/hello") -> "http://127.0.0.1:1234/";

    Security Warning: Routing is not a security feature. Use auth filters to secure routes. Some predicates like ForwardedHost, JWTPayload*, QueryParam, Source, ClientIP, and OTelBaggage have known security considerations (e.g., potential for forgery or bypass) if the upstream proxy layer is not correctly configured.

  11. Understand the Skipper routing lifecycle and extension points

    master

    Skipper provides three main extension points to customize routing behavior at different stages of the lifecycle. These are categorized into control plane (route-level) and data plane (request-level) operations:

    1. PreProcessors (Control Plane): Modify or inspect route definitions (eskip.Route) before they are instantiated.
    2. PostProcessors (Control Plane): Modify or inspect instantiated routes (routing.Route) after instantiation but before they are added to the active routing table.
    3. Filters (Data Plane): Process individual HTTP requests and responses during runtime traffic handling.

    Processing Order:

    1. DataClient loads raw route data.
    2. PreProcessors run on eskip.Route definitions.
    3. Routes are instantiated into routing.Route objects and Filters are created.
    4. PostProcessors run on the instantiated routes.
    5. Routes become active in the routing table.
    6. Filters process incoming HTTP traffic.
  12. Understand Skipper Core Concepts and Terminology

    master

    Skipper uses a specific domain language to define and execute routing. Key concepts include:

    • Eskip: The domain-specific language used to define routing rules (predicates, filters, and backends).
    • Route: A rule that matches HTTP requests and defines processing and forwarding.
    • Route Definition: The static representation of a route in Eskip syntax.
    • Route Instance: The compiled runtime representation of a route ready for matching.
    • Route ID: A unique identifier for a route (e.g., "kube__healthz_down").
    • Routing Tree: An immutable radix tree of route instances used for fast path-based lookups.
    • Atomic Switching: The process of replacing the active routing tree with a new one without blocking in-flight requests.