Categorygithub.com/lab42/ingress-backend
repositorypackage
0.1.15
Repository: https://github.com/lab42/ingress-backend.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Ingress Backendl

Latest Tag Build Status Go Version License Go Report Card SonarCloud Quality Gate



Overview

This Docker image provides a simple, customizable ingress-backend page solution for Kubernetes ingress controllers. Built on a scratch container, it minimizes attack vectors and enhances security. It can be used as a default backend to handle undefined or unmatched routes across various ingress implementations.

Default HTML example can be found using the following link

Example

Features

  • Lightweight Docker image (based on scratch for reduced attack surface)
  • Customizable HTML ingress-backend page
  • Easily configurable
  • Compatible with multiple Kubernetes ingress controllers
  • Prometheus metrics (:8080/metrics)

Configuration Options

ingress-backend can be configured using command-line arguments, environment variables, or a YAML configuration file. The following options are available:

  • --port / INGRESS_BACKEND_PORT: HTTP server port (default 1234)
  • --path / INGRESS_BACKEND_PATH: Root file path (not required)
  • --config: Path to config file (default: $HOME/.ingress-backend.yaml)

Example YAML Configuration File

You can also use a YAML configuration file to specify options. Here's an example:

# .ingress-backend.yaml
port: 1234
path: ""

The config file will be automatically loaded from your home directory if named .ingress-backend.yaml. Alternatively, you can specify a custom path:

ingress-backend --config path/to/config.yaml

Supported Ingress Controllers

Nginx Ingress Controller

Helm Installation

helm install nginx-ingress ingress-nginx/ingress-nginx \
  --set defaultBackend.enabled=false \
  --set controller.defaultBackend.enabled=false

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingress-backend-backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ingress-backend-backend
  template:
    metadata:
      labels:
        app: ingress-backend-backend
    spec:
      containers:
      - name: ingress-backend-backend
        image: ghcr.io/lab42/ingress-backend:latest
        ports:
        - containerPort: 1234
---
apiVersion: v1
kind: Service
metadata:
  name: ingress-backend-backend
spec:
  selector:
    app: ingress-backend-backend
  ports:
  - port: 80
    targetPort: 1234

Configure Nginx Ingress

apiVersion: networking.k8s.io/v1
kind: Deployment
metadata:
  name: nginx-ingress-controller
spec:
  template:
    spec:
      containers:
      - name: nginx-ingress-controller
        args:
        - /nginx-ingress-controller
        - --default-backend-service=$(POD_NAMESPACE)/ingress-backend-backend

Traefik Ingress Controller

Helm Installation

helm install traefik traefik/traefik \
  --set ports.traefik.expose=true

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingress-backend-backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ingress-backend-backend
  template:
    metadata:
      labels:
        app: ingress-backend-backend
    spec:
      containers:
      - name: ingress-backend-backend
        image: ghcr.io/lab42/ingress-backend:latest
        ports:
        - containerPort: 1234
---
apiVersion: v1
kind: Service
metadata:
  name: ingress-backend-backend
spec:
  selector:
    app: ingress-backend-backend
  ports:
  - port: 80
    targetPort: 1234

Contour Ingress Controller

Helm Installation

helm install contour bitnami/contour

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingress-backend-backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ingress-backend-backend
  template:
    metadata:
      labels:
        app: ingress-backend-backend
    spec:
      containers:
      - name: ingress-backend-backend
        image: ghcr.io/lab42/ingress-backend:latest
        ports:
        - containerPort: 1234
---
apiVersion: v1
kind: Service
metadata:
  name: ingress-backend-backend
spec:
  selector:
    app: ingress-backend-backend
  ports:
  - port: 80
    targetPort: 1234

Ambassador (Emissary-Ingress) Controller

Helm Installation

helm install ambassador datawire/ambassador

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ingress-backend-backend
spec:
  replicas: 2
  selector:
    matchLabels:
      app: ingress-backend-backend
  template:
    metadata:
      labels:
        app: ingress-backend-backend
    spec:
      containers:
      - name: ingress-backend-backend
        image: ghcr.io/lab42/ingress-backend:latest
        ports:
        - containerPort: 1234
---
apiVersion: v1
kind: Service
metadata:
  name: ingress-backend-backend
spec:
  selector:
    app: ingress-backend-backend
  ports:
  - port: 80
    targetPort: 1234

Contributors

Note on Windows Support

Please be aware that I do not use Windows as part of my workflow. As a result, I cannot provide support for Windows-related issues or configurations. However, I do generate Windows executables as a courtesy for those who need them.

Thank you for your understanding!

Contributing

I welcome contributions to this project! If you have ideas for new features or improvements, please submit a feature request or contribute directly to the project.

License

This project is licensed under the MIT License.