Convert Figma logo to code with AI

kubernetes logoingress-nginx

Ingress-NGINX Controller for Kubernetes

17,241
8,201
17,241
475

Top Related Projects

NGINX and NGINX Plus Ingress Controllers for Kubernetes

50,858

The Cloud Native Application Proxy

35,857

Connect, secure, control, and observe services.

3,721

Contour is a Kubernetes ingress controller using Envoy proxy.

:gorilla: Kong for Kubernetes: The official Ingress Controller for Kubernetes.

Quick Overview

The kubernetes/ingress-nginx project is an Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer. It provides a robust and feature-rich solution for managing external access to HTTP and HTTPS services in a Kubernetes cluster, offering advanced traffic routing, SSL/TLS termination, and various customization options.

Pros

  • Highly configurable and flexible, supporting a wide range of use cases
  • Excellent performance and scalability, suitable for high-traffic environments
  • Active community support and regular updates
  • Extensive documentation and integration with Kubernetes ecosystem

Cons

  • Steeper learning curve compared to some simpler Ingress controllers
  • Resource-intensive for large-scale deployments
  • Configuration complexity can lead to potential misconfigurations
  • May require additional setup for certain advanced features

Code Examples

  1. Basic Ingress resource:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: example-service
            port: 
              number: 80

This example defines a basic Ingress resource that routes traffic for example.com to an example-service on port 80.

  1. Configuring SSL/TLS:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tls-example-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  tls:
  - hosts:
    - secure.example.com
    secretName: tls-secret
  rules:
  - host: secure.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: secure-service
            port: 
              number: 443

This example shows how to configure SSL/TLS for an Ingress resource using a secret containing the certificate and key.

  1. Rate limiting configuration:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: rate-limit-example
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/limit-rps: "10"
spec:
  rules:
  - host: api.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: api-service
            port: 
              number: 8080

This example demonstrates how to apply rate limiting to an Ingress resource, limiting requests to 10 per second.

Getting Started

  1. Install the NGINX Ingress Controller:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml
  1. Create an Ingress resource:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port: 
              number: 80
  1. Apply the Ingress resource:
kubectl apply -f ingress.yaml
  1. Verify the Ingress is working:
kubectl get ingress

Competitor Comparisons

NGINX and NGINX Plus Ingress Controllers for Kubernetes

Pros of kubernetes-ingress

  • Commercial support available from NGINX, Inc.
  • Advanced features like JWT validation and app protect WAF
  • More granular configuration options for NGINX-specific settings

Cons of kubernetes-ingress

  • Steeper learning curve due to more complex configuration
  • Less community-driven development compared to ingress-nginx
  • May require a commercial license for certain advanced features

Code Comparison

ingress-nginx configuration:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /prefix(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: example-service
            port: 
              number: 80

kubernetes-ingress configuration:

apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
  name: example-virtual-server
spec:
  host: example.com
  upstreams:
  - name: example-upstream
    service: example-service
    port: 80
  routes:
  - path: /prefix
    action:
      proxy:
        upstream: example-upstream
        rewritePath: /$request_uri

Both ingress controllers offer robust solutions for managing ingress in Kubernetes clusters. ingress-nginx is more widely adopted and community-driven, while kubernetes-ingress provides advanced features and commercial support. The choice between them depends on specific project requirements and preferences.

50,858

The Cloud Native Application Proxy

Pros of Traefik

  • More versatile, supporting multiple platforms beyond Kubernetes
  • Built-in automatic HTTPS with Let's Encrypt integration
  • Dynamic configuration with real-time updates

Cons of Traefik

  • Steeper learning curve due to more complex configuration options
  • Less specialized for Kubernetes-specific use cases
  • Potentially higher resource usage in some scenarios

Code Comparison

ingress-nginx configuration:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /prefix(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: example-service
            port: 
              number: 80

Traefik configuration:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: example-ingressroute
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`example.com`) && PathPrefix(`/prefix`)
    kind: Rule
    services:
    - name: example-service
      port: 80
    middlewares:
    - name: strip-prefix

Both ingress-nginx and Traefik are popular ingress controllers for Kubernetes, but they have different strengths and use cases. ingress-nginx is more focused on Kubernetes-specific deployments, while Traefik offers broader platform support and additional features like automatic HTTPS. The choice between them depends on specific project requirements and the desired level of complexity in configuration.

35,857

Connect, secure, control, and observe services.

Pros of Istio

  • Offers comprehensive service mesh capabilities beyond just ingress control
  • Provides advanced traffic management, security, and observability features
  • Supports multi-cluster and multi-cloud deployments

Cons of Istio

  • More complex to set up and manage compared to simpler ingress solutions
  • Higher resource overhead due to its extensive feature set
  • Steeper learning curve for teams new to service mesh concepts

Code Comparison

Ingress-Nginx configuration example:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: example-service
            port: 
              number: 80

Istio Virtual Service example:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: example-vs
spec:
  hosts:
  - example.com
  http:
  - route:
    - destination:
        host: example-service
        port:
          number: 80

While Ingress-Nginx focuses on ingress traffic management, Istio provides a more comprehensive approach to service-to-service communication and traffic management within the cluster. Istio's configuration is more verbose but offers greater flexibility and advanced features for complex scenarios.

3,721

Contour is a Kubernetes ingress controller using Envoy proxy.

Pros of Contour

  • Designed for high-performance and scalability, particularly suitable for large-scale deployments
  • Supports advanced traffic routing features like weighted load balancing and canary deployments
  • Utilizes Envoy proxy, offering more flexibility and modern networking capabilities

Cons of Contour

  • Steeper learning curve compared to ingress-nginx due to its more complex architecture
  • Less widespread adoption and community support than ingress-nginx
  • May require additional resources and configuration for smaller deployments

Code Comparison

ingress-nginx configuration:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: example-service
            port: 
              number: 80

Contour configuration:

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: example-proxy
spec:
  virtualhost:
    fqdn: example.com
  routes:
    - conditions:
      - prefix: /
      services:
        - name: example-service
          port: 80

Both configurations achieve similar results, but Contour uses its custom HTTPProxy resource for more advanced routing capabilities.

:gorilla: Kong for Kubernetes: The official Ingress Controller for Kubernetes.

Pros of kubernetes-ingress-controller

  • Built-in API gateway functionality with advanced features like rate limiting and authentication
  • Extensive plugin ecosystem for extending functionality
  • Better performance and scalability for high-traffic environments

Cons of kubernetes-ingress-controller

  • Steeper learning curve due to additional features and complexity
  • Requires more resources to run compared to ingress-nginx
  • May be overkill for simple use cases or smaller deployments

Code Comparison

ingress-nginx configuration:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: example-service
            port: 
              number: 80

kubernetes-ingress-controller configuration:

apiVersion: configuration.konghq.com/v1
kind: KongIngress
metadata:
  name: example-kong-ingress
route:
  protocols:
  - http
  - https
  strip_path: true
upstream:
  hash_on: none
  hash_fallback: none
  healthchecks:
    active:
      healthy:
        http_statuses:
        - 200
        interval: 5
        successes: 5

The kubernetes-ingress-controller configuration allows for more detailed customization of routing, upstream behavior, and health checks, while ingress-nginx uses a simpler configuration focused on basic routing.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Ingress NGINX Controller

CII Best Practices Go Report Card GitHub license GitHub stars GitHub stars

Overview

ingress-nginx is an Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer.

Learn more about Ingress on the Kubernetes documentation site.

Get started

See the Getting Started document.

Troubleshooting

If you encounter issues, review the troubleshooting docs, file an issue, or talk to us on the #ingress-nginx channel on the Kubernetes Slack server.

Changelog

See the list of releases for all changes. For detailed changes for each release, please check the changelog-$version.md file for the release version. For detailed changes on the ingress-nginx helm chart, please check the changelog folder for a specific version. CHANGELOG-$current-version.md file.

Supported Versions table

Supported versions for the ingress-nginx project mean that we have completed E2E tests, and they are passing for the versions listed. Ingress-Nginx versions may work on older versions, but the project does not make that guarantee.

SupportedIngress-NGINX versionk8s supported versionAlpine VersionNginx VersionHelm Chart Version
🔄v1.11.21.30, 1.29, 1.28, 1.27, 1.263.20.01.25.54.11.2
🔄v1.11.11.30, 1.29, 1.28, 1.27, 1.263.20.01.25.54.11.1
🔄v1.11.01.30, 1.29, 1.28, 1.27, 1.263.20.01.25.54.11.0
🔄v1.10.41.30, 1.29, 1.28, 1.27, 1.263.20.01.25.54.10.4
🔄v1.10.31.30, 1.29, 1.28, 1.27, 1.263.20.01.25.54.10.3
🔄v1.10.21.30, 1.29, 1.28, 1.27, 1.263.20.01.25.54.10.2
🔄v1.10.11.30, 1.29, 1.28, 1.27, 1.263.19.11.25.34.10.1
🔄v1.10.01.29, 1.28, 1.27, 1.263.19.11.25.34.10.0
v1.9.61.29, 1.28, 1.27, 1.26, 1.253.19.01.21.64.9.1
v1.9.51.28, 1.27, 1.26, 1.253.18.41.21.64.9.0
v1.9.41.28, 1.27, 1.26, 1.253.18.41.21.64.8.3
v1.9.31.28, 1.27, 1.26, 1.253.18.41.21.64.8.*
v1.9.11.28, 1.27, 1.26, 1.253.18.41.21.64.8.*
v1.9.01.28, 1.27, 1.26, 1.253.18.21.21.64.8.*
v1.8.41.27, 1.26, 1.25, 1.243.18.21.21.64.7.*
v1.7.11.27, 1.26, 1.25, 1.243.17.21.21.64.6.*
v1.6.41.26, 1.25, 1.24, 1.233.17.01.21.64.5.*
v1.5.11.25, 1.24, 1.233.16.21.21.64.4.*
v1.4.01.25, 1.24, 1.23, 1.223.16.21.19.10†4.3.0
v1.3.11.24, 1.23, 1.22, 1.21, 1.203.16.21.19.10†4.2.5

See this article if you want upgrade to the stable Ingress API.

Get Involved

Thanks for taking the time to join our community and start contributing!

  • This project adheres to the Kubernetes Community Code of Conduct. By participating in this project, you agree to abide by its terms.

  • Contributing: Contributions of all kinds are welcome!

    • Read CONTRIBUTING.md for information about setting up your environment, the workflow that we expect, and instructions on the developer certificate of origin that we require.
    • Join our Kubernetes Slack channel for developer discussion : #ingress-nginx-dev.
    • Submit GitHub issues for any feature enhancements, bugs, or documentation problems.
      • Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.
    • Join our ingress-nginx-dev mailing list
  • Support:

License

Apache License 2.0