Higress 可能是最好的云原生网关

官方文档:https://higress.cn/docs/latest/overview/what-is-higress/

1、简介

Higress 是阿里研发的一款云原生 API 网关,以开源 Istio + Envoy 为核心构建的云原生 API 网关,实现了流量网关 + 微服务网关 + 安全网关三合一的高集成能力,深度集成 Dubbo、Nacos、Sentinel 等微服务技术栈,能够帮助用户极大的降低网关的部署及运维成本;在标准上全面支持 Ingress 与 Gateway API,积极拥抱云原生下的标准 API 规范;同时,Higress Controller 也支持 Nginx Ingress 平滑迁移,帮助用户零成本快速迁移到 Higress。

Higress 在阿里内部为解决 Tengine reload 对长连接业务有损,以及 gRPC/Dubbo 负载均衡能力不足而诞生。

阿里云基于 Higress 构建了云原生 API 网关产品,为大量企业客户提供 99.99% 的网关高可用保障服务能力。

Higress 基于 AI 网关能力,支撑了通义千问 APP、百炼大模型 API、机器学习 PAI 平台等 AI 业务。同时服务国内头部的 AIGC 企业(如零一万物),以及 AI 产品(如 FastGPT)

1.1 特点:

  • 生产等级  脱胎于阿里巴巴多年生产验证的内部产品,支持每秒请求量达数十万级的大规模场景。彻底摆脱 Nginx reload 引起的流量抖动,配置变更毫秒级生效且业务无感。对 AI 业务等长连接场景特别友好。
  • 便于扩展  提供丰富的官方插件库,涵盖 AI、流量管理、安全防护等常用功能,满足90%以上的业务场景需求。主打 Wasm 插件扩展,通过沙箱隔离确保内存安全,支持多种编程语言,允许插件版本独立升级,实现流量无损热更新网关逻辑。
  • 安全易用  基于 Ingress API 和 Gateway API 标准,提供开箱即用的 UI 控制台,WAF 防护插件、IP/Cookie CC 防护插件开箱即用。支持对接 Let’s Encrypt 自动签发和续签免费证书,并且可以脱离 K8s 部署,一行 Docker 命令即可启动,方便个人开发者使用。
  • 流式处理  支持真正的完全流式处理请求/响应 Body,Wasm 插件很方便地自定义处理 SSE (Server-Sent Events)等流式协议的报文。在 AI 业务等大带宽场景下,可以显著降低内存开销。

1.2 使用场景

  • Kubernetes Ingress 网关:Higress 可以作为 K8s 集群的 Ingress 入口网关, 并且兼容了大量 K8s Nginx Ingress 的注解,可以从 K8s Nginx Ingress 快速平滑迁移到 Higress。支持 Gateway API 标准,支持用户从 Ingress API 平滑迁移到 Gateway API。

    相比 ingress-nginx,资源开销大幅下降,路由变更生效速度有十倍提升:

           

       

  • 微服务网关:Higress 可以作为微服务网关, 能够对接多种类型的注册中心发现服务配置路由,例如 Nacos, ZooKeeper, Consul, Eureka 等。并且深度集成了 DubboNacosSentinel 等微服务技术栈,基于 Envoy C++ 网关内核的出色性能,相比传统 Java 类微服务网关,可以显著降低资源使用率,减少成本。
  • 安全防护网关:

    Higress 可以作为安全防护网关, 提供 WAF 的能力,并且支持多种认证鉴权策略,例如 key-auth, hmac-auth, jwt-auth, basic-auth, oidc 等。

2.安装部署

查看 Higress 有哪些版本:

[root@km1 ~]# helm repo add higress.io https://higress.cn/helm-charts
[root@km1 ~]# helm search repo higress.io/higress -l 
 NAME                      	CHART VERSION	APP VERSION	DESCRIPTION                              
higress.io/higress        	2.2.2        	2.2.2      	Helm chart for deploying Higress gateways
higress.io/higress        	2.2.1        	2.2.1      	Helm chart for deploying Higress gateways
higress.io/higress        	2.2.0        	2.2.0      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.11       	2.1.11     	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.10       	2.1.10     	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.9        	2.1.9      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.8        	2.1.8      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.7        	2.1.7      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.6        	2.1.6      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.5        	2.1.5      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.4        	2.1.4      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.3        	2.1.3      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.2        	2.1.2      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.1        	2.1.1      	Helm chart for deploying Higress gateways
higress.io/higress        	2.1.0        	2.1.0      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.7        	2.0.7      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.6        	2.0.6      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.5        	2.0.5      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.4        	2.0.4      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.3        	2.0.3      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.2        	2.0.2      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.1        	2.0.1      	Helm chart for deploying Higress gateways
higress.io/higress        	2.0.0        	2.0.0      	Helm chart for deploying Higress gateways
higress.io/higress        	1.4.2        	1.4.2      	Helm chart for deploying Higress gateways
higress.io/higress        	1.4.1        	1.4.1      	Helm chart for deploying Higress gateways

Helm 安装命令:

参数配置:https://higress.cn/docs/latest/user/configurations/

注意

higress-core.gateway.hostNetwork=true,让 Higress 监听本机端口

higress-core.gateway.service.type=ClusterIP,改服务类型为ClusterIP,默认为LoadBalancer

higress-core.gateway.kind=DaemonSet , 修改部署类型为DaemonSet

helm install higress -n higress-system higress.io/higress --version 2.1.11 \
--create-namespace --render-subchart-notes \
--set higress-core.gateway.hostNetwork=true \
--set higress-core.gateway.service.type=ClusterIP \
--set higress-core.gateway.kind=DaemonSet
注意

当helm版本在 3.10之前,higress 版本 2.1.5 及其之后,使用上面的部署命令,会报错,内容如下:

 Error: INSTALLATION FAILED: template: higress/charts/higress-core/templates/daemonset.yaml:30:6: executing "higress/charts/higress-core/templates/daemonset.yaml" at <include "gateway.podTemplate" $>: error calling include: template: higress/charts/higress-core/templates/_pod.tpl:133:15: executing "gateway.podTemplate" at <include "skywalking.enabled" .>: error calling include: template: higress/charts/higress-core/templates/_helpers.tpl:100:106: executing "skywalking.enabled" at <.Values.tracing.skywalking.service>: nil pointer evaluating interface {}.service

解决办法:将 helm 版本升级到 3.10及其之后

部署成功,输出状态:

NAME: higress
LAST DEPLOYED: Tue May 20 16:02:10 2025
NAMESPACE: higress-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Higress successfully installed!

To learn more about the release, try:
  $ helm status higress -n higress-system
  $ helm get all higress -n higress-system

Use the following command to access the console:
  hgctl dashboard console

查看网络监听状态(80,443):

[root@k8s-worker01 ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      197045/envoy        
tcp        0      0 127.0.0.1:39345         0.0.0.0:*               LISTEN      117086/kubelet      
tcp        0      0 0.0.0.0:15090           0.0.0.0:*               LISTEN      197045/envoy        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1381/sshd           
tcp        0      0 127.0.0.1:15000         0.0.0.0:*               LISTEN      197045/envoy        
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      197045/envoy