هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
Know it before you install
An Ingress object says "host + path → Service"; an ingress controller (like ingress-nginx) makes it work. The Gateway API is the newer standard with clear roles: a GatewayClass (which controller), a Gateway (listeners: ports, hostnames, TLS — owned by the platform team) and HTTPRoutes (routes — owned by app teams).
| Item | ingress-nginx | Gateway API (Envoy Gateway) |
|---|---|---|
| Status | Retired (no fixes since March 2026) | Active standard (Kubernetes SIG Network) |
| Install | Helm chart ingress-nginx | Helm chart oci://docker.io/envoyproxy/gateway-helm |
| Objects | Ingress + many annotations | GatewayClass, Gateway, HTTPRoute, GRPCRoute … |
| Namespace | ingress-nginx | envoy-gateway-system |
| Other controllers | — | NGINX Gateway Fabric, Traefik, Cilium, Istio, Kong, HAProxy |
Existing clusters: run ingress-nginx safely
If a cluster still uses ingress-nginx, keep it on the last release, plan the migration, and reduce risk:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm search repo ingress-nginx/ingress-nginx --versions | head -3
helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx --namespace ingress-nginx --create-namespace --version LAST_VERSION
kubectl -n ingress-nginx get pods,svc
kubectl get ingressclassانتبه
Use the last chart version and read its notes. In 2025 a critical bug in the admission webhook ("IngressNightmare", CVE-2025-1974) allowed code execution in the controller — keep the admission webhook reachable only from the API server, and limit who may create Ingress objects. With no more security fixes, every new CVE stays open: migrate.
A typical Ingress with TLS from cert-manager:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
namespace: shop
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-body-size: "20m"
spec:
ingressClassName: nginx
tls:
- hosts: [shop.example.com]
secretName: shop-tls
rules:
- host: shop.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service: { name: shop, port: { number: 80 } }Also: turn off risky features you do not use (allow-snippet-annotations: "false" in the controller ConfigMap), and inventory which annotations your Ingresses use — they decide how hard the migration is.
New clusters: install a Gateway API controller
Envoy Gateway installs the Gateway API CRDs and its controller in one chart (pin the version from its releases):
First configuration: GatewayClass, Gateway and HTTPRoute
The platform team owns the class and the Gateway (ports, hostnames, TLS):
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: eg
spec:
controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: public
namespace: gateway
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
gatewayClassName: eg
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces: { from: All }
- name: https
protocol: HTTPS
port: 443
hostname: "*.example.com"
tls:
mode: Terminate
certificateRefs:
- name: wildcard-example-tls
allowedRoutes:
namespaces:
from: Selector
selector:
matchLabels: { gateway-access: "true" }App teams own their routes, in their own namespace:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: shop
namespace: shop
spec:
parentRefs:
- name: public
namespace: gateway
sectionName: https
hostnames: ["shop.example.com"]
rules:
- matches:
- path: { type: PathPrefix, value: /api }
backendRefs:
- name: shop-api
port: 8080
- backendRefs:
- name: shop-web
port: 80kubectl create namespace gateway
kubectl label namespace shop gateway-access=true
kubectl apply -f gateway.yaml -f httproute.yaml
kubectl -n gateway get gateway public
NAME CLASS ADDRESS PROGRAMMED
public eg 203.0.113.40 True
kubectl -n shop get httproute shop -o jsonpath='{.status.parents[0].conditions[*].type}'| Part | Why |
|---|---|
allowedRoutes with a namespace selector | Only labelled namespaces may attach routes to the public HTTPS listener. |
| TLS on the Gateway | One place for certificates (cert-manager with Gateway API support turned on: config.enableGatewayAPI=true). |
| HTTPRoute in the app namespace | Teams change their routes without touching the shared Gateway. |
Weighted backendRefs | Canary releases without annotations (weight: 90 / weight: 10). |
An HTTP → HTTPS redirect is one more HTTPRoute on the http listener with a RequestRedirect filter (scheme: https, statusCode: 301).
Migrate from Ingress to Gateway API
- Inventory:
kubectl get ingress -A -o yaml— list hosts, TLS secrets and everynginx.ingress.kubernetes.io/*annotation. - Convert: the
ingress2gatewaytool writes Gateway API YAML from your Ingresses:
go install github.com/kubernetes-sigs/ingress2gateway@latest
ingress2gateway print --providers=ingress-nginx --all-namespaces > converted.yaml- Review the output (annotations without a Gateway API match need filters or policies of your controller).
- Run both side by side: the new Gateway gets its own IP; test with
curl --resolve shop.example.com:443:NEW_IP https://shop.example.com/. - Move DNS host by host; watch errors; then delete the Ingresses and finally ingress-nginx.
Daily use: the commands and the real uses
kubectl get gatewayclass,gateway -A
kubectl get httproute -A
kubectl -n shop describe httproute shop
kubectl -n envoy-gateway-system logs deploy/envoy-gateway --tail 50
kubectl get ingress -A
kubectl -n ingress-nginx logs deploy/ingress-nginx-controller --tail 50Real uses at work:
- One public entry for all apps, with TLS, redirects, path routing and canaries.
- Clear ownership: platform team (Gateway) vs. app teams (Routes).
- Planning and running the ingress-nginx → Gateway API migration in 2026 clusters.
Make it safe
Security checklist:
- Do not start new work on ingress-nginx; plan its removal (no security fixes).
- Until then: last release, admission webhook only reachable from the API server, snippet annotations off, RBAC on who can create Ingresses.
- Gateway listeners: limit
allowedRoutesto labelled namespaces; HTTPS only with HSTS. - Keep the Gateway controller updated; pin chart versions.
- Rate limits and auth with the controller's policies (for example Envoy Gateway
SecurityPolicy,BackendTrafficPolicy).
Update and remove
Fix common problems
| Problem | Cause | Fix |
|---|---|---|
Gateway PROGRAMMED is False | No address (no LoadBalancer in the cluster) or bad listener. | kubectl describe gateway; on bare metal use MetalLB or a NodePort service. |
HTTPRoute Accepted: False (NotAllowedByListeners) | The namespace is not allowed by allowedRoutes. | Label the namespace, or fix sectionName/hostnames. |
HTTPRoute ResolvedRefs: False | Backend Service name/port wrong, or another namespace without a ReferenceGrant. | Fix the Service; add a ReferenceGrant for cross-namespace backends. |
| 404 from ingress-nginx | No rule for the host, or wrong ingressClassName. | kubectl get ingress -A; check host and class. |
| ingress-nginx 413 / timeouts | Size and timeout annotations. | proxy-body-size, proxy-read-timeout annotations (and plan the Gateway equivalent). |
| Certificate missing on the Gateway | cert-manager Gateway API support is off. | Enable it in cert-manager (config.enableGatewayAPI=true) and check the Certificate. |
Next steps
- Quick how-to: Expose an app with an Ingress or Gateway and TLS.
- Learn it for the CKA: Ingress and Gateway API, Write an Ingress, Troubleshoot routing.
- TLS for both: cert-manager. Charts: Helm.
- Other controllers: Traefik, Istio.
1Why should a new cluster not use ingress-nginx?
It is retired: since March 2026 there are no releases and no security fixes.
2In the Gateway API, which object does the app team own, and which the platform team?
App teams own HTTPRoutes; the platform team owns the GatewayClass and the Gateway.