Skip to content

Basic Setup

This example shows a basic Ingress configuration for a simple reverse proxy setup.

Source files live under examples/basic/.

Minimal configuration

yaml
version: v1
port: 8080

# Same inferred mode (service); compare spelling explicit backend.type vs omission.
rules:
  - host: app-with-type.example.com
    backend:
      type: service
      service:
        name: backend-service
        port: 8080
  - host: app-inferred.example.com
    backend:
      service:
        name: backend-service
        port: 8080

Explanation

  • port: Ingress listens on port 8080
  • rules: Defines routing rules
  • host: Matches requests with Host: example.com
  • backend.service: Routes to backend-service on port 8080

Testing

bash
ingress run -c examples/basic/ingress.yaml
bash
curl -H "Host: example.com" http://localhost:8080

Multiple services

yaml
version: v1
port: 8080

# Explicit type on one host, inferred on the other — equivalent once validated.
rules:
  - host: web.example.com
    backend:
      type: service
      service:
        name: web-service
        port: 8080
  - host: api.example.com
    backend:
      service:
        name: api-service
        port: 8081

Disabling a rule

yaml
version: v1
port: 8080

rules:
  - host: disabled.example.com
    enabled: false
    backend:
      redirect:
        url: https://old.example.com
  - host: disabled.example.com
    backend:
      handler:
        body: "still live\n"

When the first rule for disabled.example.com has enabled: false, traffic falls through to the next matching enabled rule (handler body still live in the sample).

Released under the MIT License.