README 未给出本地启动命令,需按官网快速入门指南操作;许可证为 BUSL-1.1,商用前需确认授权范围;浏览器 UI 为可选组件,需单独参考 UI 目录的 README
consul
hashicorp活跃维护分布式高可用服务网格方案,提供服务发现、配置管理和 API 网关,让动态基础设施中的应用互联互通。
Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
README 未给出可直接执行的安装命令,仅提供独立二进制、Minikube、Kind、Kubernetes 和 HCP Consul 的快速入门链接README 未说明
跨数据中心的服务发现与配置工具,自带服务网格和健康检查
分布式高可用服务网格方案,提供服务发现、配置管理和 API 网关,让动态基础设施中的应用互联互通。
核心能力
- 支持多数据中心,无需复杂配置即可跨区域部署
- 服务网格用自动 TLS 加密和基于身份的授权保护服务间通信
- 服务可通过 DNS 或 HTTP 接口自行注册与发现
- 健康检查与发现联动,避免流量路由到不健康主机
- HTTP API 存储带索引的对象,用于动态应用配置
容易踩的坑
- v2.1.0最新正式版2026-10-22 · 2026-10-22 15:36 UTC
2.1.0 (October 21, 2026)
BREAKING CHANGES:
- agent: (Enterprise only) Agent HTTP API request bodies are now limited to 512 KiB by default, including chunked requests and requests with an unsupported method, and oversized requests return HTTP 413 before the body is read in full. Very large
/v1/configwrites that previously succeeded can now fail. Raise the limit with the newlimits.http_max_request_body_sizesetting if needed. - agent: (Enterprise only) Resource API (
/api/...) request bodies are now subject to the samelimits.http_max_request_body_sizelimit (512 KiB by default), and oversized requests return HTTP 413. - agent: (Enterprise only)
GET /v1/agent/connect/ca/leaf/:servicenow requiresservice:writeon the requested service for every request, including requests served from the agent's cached leaf certificate. Requests with no token or a token without that permission now receive HTTP 403 instead of the cached certificate. Callers must present a token withservice:writefor the service. - catalog: (Enterprise only)
Catalog.Registernow requires write permission on the node or service of an existing health check when updating it. Tokens that previously updated checks without that permission now receive a permission denied error. - cli: Migrated the
consul connect redirect-trafficcommand fromiptables/ip6tablestonftables(nft). The command now uses thesdk/nftablespackage, which applies all IPv4 and IPv6 rules atomically in a single pass via thenftablesinetaddress family, instead of separateiptablesandip6tablesinvocations. [GH-23785] - cli: Transparent proxy exclusions are now validated before rules are applied: user IDs must be numeric and outbound exclusions must be IP addresses or CIDRs.
iptablespreviously also accepted user names, UID ranges, and host names. [GH-23785] - cli:
consul connect redirect-trafficdoes not removeiptables/ip6tablesrules created by earlier Consul versions. This only matters when upgrading an existing host or VM in place. Before running the new command on an existing host or VM, remove any Consul-managediptablesrules first (see the transparent proxy upgrade guide for a reference cleanup script). Leaving both rule sets in place can cause double NAT or inconsistent traffic redirection. [GH-23785] - docker: The official Consul container images now include
nftablesinstead ofiptables. Scripts that runiptablesinside the Consul image must be updated. [GH-23785] - sdk: Replaced the
iptablespackage with a newnftablespackage for transparent proxy traffic redirection. Traffic redirection now requires thenftbinary and a Linux kernel with stateful NAT support innftablesinetfamily chains, available upstream starting with Linux kernel version 5.2 (some distributions backport this support onto an earlier nominal kernel version, for example RHEL 8+, kernel 4.18+, and its derivatives). There is no automatic fallback toiptables/ip6tables, so hosts without this kernel support will fail to set up transparent proxy redirection. [GH-23785] - feature-gates: Gate API Gateway HTTPRoute upstream-routing composition (PR #23294) behind the experimental feature
api-gateway-upstream-routing. When disabled (default), the legacy HTTPRoute-to-router shape is preserved exactly. When enabled by an operator after a full datacenter upgrade, service-router rules are composed with HTTPRoute matches, resolver subset definitions are preserved, and discovery-chain watches use the correct HTTP protocol override. Existing agentless API Gateway proxy states are rebuilt automatically when the effective gate value changes.
SECURITY:
- Upgrade go version to 1.26.10 to a
- agent: (Enterprise only) Agent HTTP API request bodies are now limited to 512 KiB by default, including chunked requests and requests with an unsupported method, and oversized requests return HTTP 413 before the body is read in full. Very large
- v2.1.0-rc2pre-release2026-10-13 · 2026-10-13 06:10 UTC
查看更新说明
2.1.0-rc2 (October 12, 2026)
SECURITY:
- Upgrade go version to 1.26.9 to address security vulnerabilities. [GH-24010]
- deps: Upgrade github.com/hashicorp/raft-wal to v0.5.0 (with raft v1.8.0, serf v0.11.0, memberlist v0.7.0 and go-metrics v0.7.0), removing the dependency on github.com/coreos/etcd. [GH-23985]
- deps: Upgrade golang.org/x/net to v0.60.0 to address GO-2026-6610, GO-2026-6611, GO-2026-6603, GO-2026-6617 and GO-2026-6612. [GH-23994]
- docker: Run
apk upgradewhen building the Alpine-based container images so base-image packages (such as sqlite and jq) are up to date. [GH-23964] - security: Upgrade github.com/klauspost/compress to v1.18.7, go.mongodb.org/mongo-driver to v1.17.10, github.com/moby/go-archive to v0.3.0 and github.com/go-openapi/swag to v0.27.1 to address CVE-2026-63209, CVE-2026-88031, CVE-2026-2303, CVE-2026-17106 and CVE-2026-85280. [GH-23964]
- ui: Add Content-Security-Policy header to Consul UI HTTP responses to mitigate XSS and data injection attacks. [GH-23971]
- ui: Pin a newer resolution of morgan to 1.12.1 to address GHSA-9f6g-j8ch-79g4 [GH-23952]
IMPROVEMENTS:
- connect: deliver the sidecar proxy's leaf certificate and CA roots to Envoy over SDS instead of embedding them inline in the public listener. Leaf certificate rotation is now a hitless hot-swap that no longer changes the listener filter chain hash, so established connections (notably long-lived TCP sessions) are no longer drained and terminated on every rotation. [GH-23938]
- terminating-gateway: deliver each linked service's Connect leaf certificate and the shared CA roots to Envoy over SDS instead of embedding them inline in the gateway's downstream filter chains. Leaf rotation no longer changes the filter chain hash, so established connections through the gateway are no longer drained. [GH-23938]
BUG FIXES:
- proxycfg: Fixed a goroutine and memory leak where a proxy's watches kept running after its state stopped unexpectedly, because replacing, deregistering or closing a stopped state did not cancel them. [GH-23990]
- proxycfg: Fixed a goroutine and memory leak where transparent proxies registered a new health watch for every imported peered service each time the imported services list changed, and never stopped watches for removed upstreams. [GH-23990]
- telemetry: Restore Raft, Serf, and Memberlist metrics in release artifacts by building with the
hashicorpmetricstag. [GH-23813]
- v2.1.0-rc1pre-release2026-09-29 · 2026-09-29 05:22 UTC
查看更新说明
2.1.0-rc1 (September 28, 2026)
BREAKING CHANGES:
- cli: Migrated the
consul connect redirect-trafficcommand fromiptables/ip6tablestonftables(nft). The command now uses thesdk/nftablespackage, which applies all IPv4 and IPv6 rules atomically in a single pass via thenftablesinetaddress family, instead of separateiptablesandip6tablesinvocations. [GH-23785] - cli: Transparent proxy exclusions are now validated before rules are applied: user IDs must be numeric and outbound exclusions must be IP addresses or CIDRs.
iptablespreviously also accepted user names, UID ranges, and host names. [GH-23785] - cli:
consul connect redirect-trafficdoes not removeiptables/ip6tablesrules created by earlier Consul versions. This only matters when upgrading an existing host or VM in place. Before running the new command on an existing host or VM, remove any Consul-managediptablesrules first (see the transparent proxy upgrade guide for a reference cleanup script). Leaving both rule sets in place can cause double NAT or inconsistent traffic redirection. [GH-23785] - docker: The official Consul container images now include
nftablesinstead ofiptables. Scripts that runiptablesinside the Consul image must be updated. [GH-23785] - sdk: Replaced the
iptablespackage with a newnftablespackage for transparent proxy traffic redirection. Traffic redirection now requires thenftbinary and a Linux kernel with stateful NAT support innftablesinetfamily chains, available upstream starting with Linux kernel version 5.2 (some distributions backport this support onto an earlier nominal kernel version, for example RHEL 8+, kernel 4.18+, and its derivatives). There is no automatic fallback toiptables/ip6tables, so hosts without this kernel support will fail to set up transparent proxy redirection. [GH-23785]
SECURITY:
- Added debounce behavior to enforce a minimum interval between expensive federation-state anti-entropy sync operations. [GH-23196]
- Update
brace-expansionto address GHSA-rgw5-rvv9-x895 (DoS via unbounded intermediate arrays). [GH-23786] - Update
fast-urito address GHSA-7p8r-x3mc-p8w7 (Host Confusion via backslash authority introducer). [GH-23786] - Update
socket.io-parserto address CVE-2026-69185 (Zero-attachment Memory Exhaustion). [GH-23786]
FEATURES:
- agent: (Enterprise only) Add an inline
aiblock to service definitions, letting a workload declare its AI role (inference-model,mcp-server, orai-agent) and role-specific configuration in a single registration via config files and HTTP APIs. [GH-13032] - api-gateway: Add
http2andgrpcas valid API Gateway listener protocols, enabling end-to-end HTTP/2 and gRPC from client to backend. Previously onlyhttpandtcpwere accepted; the gateway would silently downgrade gRPC/HTTP2 traffic to HTTP/1.1 on the upstream hop. The new protocols render the correct downstream HTTP connection manager (HTTP/2 codec,h2,http/1.1ALPN) and align the upstream cluster to HTTP/2, closing the parity gap with Ingress Gateway. [GH-23784] - api-gateway: Auto-register DNS for services exposed via an API Gateway, resolvable at
<service>.api-gateway.consul. Populates thegateway-servicescat
- cli: Migrated the
- v2.0.42026-09-10 · 2026-09-10 06:12 UTC
查看更新说明
2.0.4 (September 10, 2026)
BREAKING CHANGES:
- acl: Tokens that hold service:write but not mesh:write will now receive a permission-denied error when attempting to attach builtin/lua or builtin/wasm EnvoyExtensions (or upstream envoy_listener_json/envoy_cluster_json escape-hatch overrides) to a service-defaults config entry, or when registering a connect-proxy sidecar with bootstrap or xDS escape-hatch keys set in the top-level Proxy.Config map or per-upstream in Proxy.Upstreams[*].Config. Operators must grant mesh:write to any token that legitimately needs these capabilities. [GH-23864]
- fips: (Enterprise only) FIPS release artifacts are renamed. Version metadata changes from
+ent.fips1402to+ent.fips1403, and package and container artifacts change from theF2suffix toF3(for example,consul-F2_1.20.4-1_amd64.debbecomesconsul-F3_1.20.4-1_amd64.deb). Pipelines that pin FIPS artifact names or version strings must be updated.
SECURITY:
- Upgrade go version to 1.26.7 to address security vulnerabilities. [GH-23869]
- acl: Require mesh:write in addition to service:write when attaching code-executing EnvoyExtensions (builtin/lua, builtin/wasm) or upstream escape-hatch overrides (envoy_listener_json, envoy_cluster_json in UpstreamConfig defaults or overrides) to a service-defaults config entry. Previously a holder of service:write on a service could attach a Lua script or Wasm module, or an upstream escape-hatch override, that Envoy compiled and executed on every proxied request as the sidecar process user, with access to mTLS private keys, request bodies, and the host filesystem. [GH-23864]
- acl: Require mesh:write in addition to service:write when registering a connect-proxy sidecar with bootstrap or xDS escape-hatch keys, whether set in the top-level Proxy.Config map or per-upstream in Proxy.Upstreams[*].Config (envoy_bootstrap_json_tpl, envoy_extra_static_listeners_json, envoy_public_listener_json, envoy_listener_json, envoy_cluster_json, envoy_local_cluster_json, envoy_extra_static_clusters_json, envoy_extra_stats_sinks_json, envoy_tracing_json, envoy_stats_config_json, envoy_listener_tracing_json). Key matching is case-insensitive to match the mapstructure decoding used downstream. Previously a holder of service:write on the proxy and its destination could inject arbitrary Envoy filter chain configuration into the sidecar bootstrap or xDS resources, including via a per-upstream override or a mixed-case key. [GH-23864]
- agent: Fixed a pre-authorization memory exhaustion vulnerability where an mTLS-authenticated RPC client with no ACL token could terminate a Consul server by sending a MessagePack request header with a large declared length. The MessagePack decoder allocated a byte slice of the declared size before method lookup, ACL token validation, or the rate-limiting interceptor could run, allowing a single oversized header to OOM-kill the server process.
Two mitigations are applied:
-
Each RPC request header is now validated against RPCMaxHeaderBytes (default 512 bytes) before it is decoded. Every length prefix in the header is checked against the limit, so an oversized value is rejected before the decoder allocates memory for it, and the connection is closed before any ACL evaluation. Request bodies remain unbounded by this limit.
-
A per-request read deadline (reusing RPCHandshakeTimeout) is applied inside handleConsulConn and handleInsecureConn so that a slow attacker trickling an oversized header cannot retain a goroutine and logical heap indefinitely.
- catalog: Fixed an incorrect authorization vulnerability where a local
ACL token with
service:writeornode:writecould delete peer-imported catalog objects by supplying a non-defa
- v2.0.32026-08-07 · 2026-08-07 17:25 UTC
查看更新说明
2.0.3 (August 7, 2026)
SECURITY:
- Update
brace-expansionto address GHSA-rgw5-rvv9-x895 (DoS via unbounded intermediate arrays). [GH-23786] - Update
fast-urito address GHSA-7p8r-x3mc-p8w7 (Host Confusion via backslash authority introducer). [GH-23786] - Update
golang.org/x/textto v0.39.0 to address GO-2026-5970. [GH-23761] - Update
google.golang.org/grpcto v1.82.1 to address GHSA-hrxh-6v49-42gf. [GH-23761] - Update
socket.io-parserto address CVE-2026-69185 (Zero-attachment Memory Exhaustion). [GH-23786] - Upgrade to use Go
1.26.5. This resolves vulnerabilities GO-2026-4970 (os). GO-2026-5856 (crypto/tls). [GH-23761] - agent: Fixed a denial-of-service vulnerability where
GET /v1/agent/connect/ca/rootsandPOST /v1/agent/connect/authorizeused the agent-side cache unconditionally, even whenhttp_config { use_cache = false }was configured by the operator. A remote caller could bypass this setting and grow the agent cache without bound by varying the request ACL token. Both endpoints now skip the cache and issue a direct RPC whenuse_cacheis disabled. (SECVULN-50292, SECVULN-50293) [GH-23797] - agent: Fixed a nil-pointer dereference panic in
ShadowServiceRouterConfigEntry.CheckEntwhen a service-router config entry contained a route with a nilDestination. A crafted snapshot restore or replication message containing such an entry could crash the FSM decode path. The nil guard now treats a missing destination as non-enterprise data and continues decoding safely. (SECVULN-50291) [GH-23797] - agent: Fixed a security bypass where a user-supplied public listener
(
envoy_public_listener_json) with an HTTP Connection Manager filter would skip Consul's inbound request-normalization defaults. An attacker could exploit the un-normalized path to bypass L7 intentiondenyrules using percent-encoded path equivalents. Consul now injects path normalization (enabled by default, unless the mesh config optionInsecureDisablePathNormalizationis set) on every HCM filter chain in user-provided public listeners before L7 intention enforcement is applied. (SECVULN-50295) [GH-23797] - agent: Fixed an unauthenticated denial-of-service vulnerability where
PUT /v1/agent/check/update/:id,PUT /v1/agent/check/register,PUT /v1/agent/service/register, andPOST /v1/agent/connect/authorizedecoded unbounded JSON request bodies before resolving the caller's ACL token. An unauthenticated caller could retain multiple large JSON decoder buffers concurrently inside the Consul process before each request was rejected with HTTP 403, causing attacker-controlled heap growth. All four endpoints now cap the request body at 512 KiB before any decoding occurs, returning HTTP 413 for oversized bodies. This limit applies to chunked transfer encoding as well as declaredContent-Length. (SECVULN-50418) [GH-23796] - agent: Fixed an unauthenticated denial-of-service vulnerability where the external gRPC and gRPC-TLS listeners accepted an unlimited number of TCP connections per source IP before any request processing, ACL check, or rate limiting could occur. A remote attacker could exhaust ag
- Update
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
- Documentation and Tutorials: [https://developer.hashicorp.com/consul]
- Forum: Discuss
Consul provides several key features:
-
Multi-Datacenter - Consul is built to be datacenter aware, and can support any number of regions without complex configuration.
-
Service Mesh - Consul Service Mesh enables secure service-to-service communication with automatic TLS encryption and identity-based authorization. Applications can use sidecar proxies in a service mesh configuration to establish TLS connections for inbound and outbound connections with Transparent Proxy.
-
API Gateway - Consul API Gateway manages access to services within Consul Service Mesh, allow users to define traffic and authorization policies to services deployed within the mesh.
-
Service Discovery - Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. External services such as SaaS providers can be registered as well.
-
Health Checking - Health Checking enables Consul to quickly alert operators about any issues in a cluster. The integration with service discovery prevents routing traffic to unhealthy hosts and enables service level circuit breakers.
-
Dynamic App Configuration - An HTTP API that allows users to store indexed objects within Consul, for storing configuration parameters and application metadata.
Consul runs on Linux, macOS, FreeBSD, Solaris, and Windows and includes an optional browser based UI. A commercial version called Consul Enterprise is also available.
Please note: We take Consul's security and our users' trust very seriously. If you believe you have found a security issue in Consul, please responsibly disclose by contacting us at [email protected].
Quick Start
A few quick start guides are available on the Consul website:
- Standalone binary install: https://learn.hashicorp.com/collections/consul/get-started-vms
- Minikube install: https://learn.hashicorp.com/tutorials/consul/kubernetes-minikube
- Kind install: https://learn.hashicorp.com/tutorials/consul/kubernetes-kind
- Kubernetes install: https://learn.hashicorp.com/tutorials/consul/kubernetes-deployment-guide
- Deploy HCP Consul: https://learn.hashicorp.com/tutorials/consul/hcp-gs-deploy
Documentation
Full, comprehensive documentation is available on the Consul website: https://developer.hashicorp.com/consul/docs
Contributing
Thank you for your interest in contributing! Please refer to CONTRIBUTING.md for guidance. For contributions specifically to the browser based UI, please refer to the UI's README.md for guidance.