Skills2026年4月15日·1 分钟阅读

ingress-nginx — Kubernetes NGINX Ingress Controller

ingress-nginx is the community Kubernetes ingress controller built on NGINX, turning Ingress and Gateway API resources into production-ready HTTP/S and TCP load-balancer configuration.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Install ingress-nginx
直接安装命令
npx -y tokrepo@latest install 52fdb775-38ce-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

TL;DR
Community Kubernetes ingress controller built on NGINX for routing HTTP/S traffic with load balancing and TLS termination.
§01

What it is

ingress-nginx is the community-maintained Kubernetes ingress controller built on NGINX. It translates Kubernetes Ingress and Gateway API resources into NGINX configuration, providing HTTP/S load balancing, TLS termination, path-based routing, and rate limiting for cluster services. It is the most widely deployed ingress controller in the Kubernetes ecosystem.

The controller targets platform engineers and DevOps teams running Kubernetes clusters who need to expose services to external traffic. It works on every major cloud provider and on-premises Kubernetes distributions.

§02

How it saves time or tokens

ingress-nginx eliminates manual NGINX configuration management. Instead of writing and reloading NGINX configs, you declare routing rules as Kubernetes Ingress resources, and the controller generates and applies the configuration automatically. Annotations provide fine-grained control over rate limiting, CORS, SSL redirects, and upstream behavior without touching NGINX config files directly.

§03

How to use

  1. Install with the official Helm chart:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx \
  -n ingress-nginx --create-namespace
  1. Create an Ingress resource for your service:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: 'true'
spec:
  ingressClassName: nginx
  rules:
  - host: app.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: my-app-svc
            port:
              number: 80
  1. Apply the resource and verify the external IP: kubectl get ingress my-app.
§04

Example

Rate limiting and CORS configuration via annotations:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  annotations:
    nginx.ingress.kubernetes.io/rate-limit: '100'
    nginx.ingress.kubernetes.io/rate-limit-window: '1m'
    nginx.ingress.kubernetes.io/enable-cors: 'true'
    nginx.ingress.kubernetes.io/cors-allow-origin: 'https://frontend.example.com'
spec:
  ingressClassName: nginx
  rules:
  - host: api.example.com
    http:
      paths:
      - path: /v1
        pathType: Prefix
        backend:
          service:
            name: api-svc
            port:
              number: 8080
§05

Related on TokRepo

§06

Common pitfalls

  • The community ingress-nginx and the NGINX Inc ingress controller are different projects. Ensure you install the community version from kubernetes.github.io/ingress-nginx.
  • Annotation typos fail silently. A misspelled annotation key is ignored, and the default behavior applies without warning.
  • TLS certificates must be stored as Kubernetes secrets and referenced in the Ingress spec. Missing or expired certificates cause 502 errors, not helpful error messages.
  • Always check the official documentation for the latest version-specific changes and migration guides before upgrading in production environments.
  • For team deployments, establish clear guidelines on configuration and usage patterns to ensure consistency across developers.

常见问题

What is the difference between ingress-nginx and NGINX Ingress Controller?+

ingress-nginx is the community-maintained controller from the Kubernetes project. NGINX Ingress Controller is a separate product by NGINX Inc (F5). They use different annotation prefixes, different Helm charts, and have different feature sets.

Does ingress-nginx support TLS termination?+

Yes. ingress-nginx handles TLS termination by referencing Kubernetes TLS secrets in the Ingress spec. It also integrates with cert-manager for automatic certificate provisioning and renewal via Let's Encrypt.

How do I enable rate limiting?+

Add the annotation nginx.ingress.kubernetes.io/rate-limit with the desired requests-per-minute value to your Ingress resource. The rate-limit-window annotation controls the time window for the limit.

Can ingress-nginx handle WebSocket traffic?+

Yes. ingress-nginx supports WebSocket connections by default. For long-lived WebSocket connections, increase the proxy-read-timeout and proxy-send-timeout annotations to prevent premature connection closure.

Does ingress-nginx work with the Gateway API?+

Yes. Recent versions of ingress-nginx support the Kubernetes Gateway API in addition to traditional Ingress resources. Gateway API provides more expressive routing capabilities and is the future direction for Kubernetes traffic management.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产