-
Notifications
You must be signed in to change notification settings - Fork 4.6k
docs: Multi-port support for v1.17 GA #19401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
1859dd1
db661ba
75aacc1
b6741a9
0966354
66c98eb
f3002bf
9c1e4cd
bf25be6
c216908
87a1fc2
7290e9d
8009aa0
28dd84c
6528f06
4303eaf
cf1201c
42eea7c
3c57d16
fa00cb7
ee7e4a8
12c7212
5e8f602
556ecda
5b24e36
7b1b91a
ead5752
0959179
bb96ad8
e95f590
3c00599
068703b
bd268ac
89addfa
3113840
7d438a3
364b49c
90e9079
28e487b
376eeb0
1b8c675
af1746b
e3ea5f2
4c464e2
da48d80
42a6ef0
f7fad9b
ea54ebb
c7628de
8d3e88e
0b0b4c9
464e4fc
a943e29
7d679fd
ac15715
3255c98
48bc056
fc15a39
ac82bda
8ba577b
4ee651e
b70c39f
179cb27
64b2bb2
ad99c00
48f47a0
4f4315c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| layout: docs | ||
| page_title: v1 Catalog API | ||
| description: Learn about version 1 of the Consul catalog, including what Consul servers record when they register a service. | ||
| --- | ||
|
|
||
| # v1 Catalog API | ||
|
|
||
| This topic provides conceptual information about version 1 (v1) of the Consul catalog API. The catalog tracks registered services and their locations for both service discovery and service mesh use cases. | ||
|
|
||
| For more information about the information returned when querying the catalog, including filtering options when querying the catalog for a list of nodes, services, or gateways, refer to the [`/catalog` endpoint reference in the HTTP API documentation](/consul/api-docs/catalog). | ||
|
|
||
| ## Introduction | ||
|
|
||
| Consul tracks information about registered services through its Catalog API. This API records user-defined information about the external services, such as their partitions and required health checks. It also records information that Consul assigns for its own operations, such as an ID for each service instance and the [Raft indices](/consul/docs/architecture/consensus) when the instance is registered and modified. | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| Consul uses v1 of the Catalog API by default. Consul v1.17.0 introduces a second version of the Catalog API for testing and development purposes. The catalog APIs cannot run concurrently in a Consul deployment. There is no migration path between catalog versions at this time. For more information, refer to [Consul v2 Catalog API](/consul/docs/architecture/catalog/v2). | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Catalog structure | ||
|
|
||
| When Consul registers a service instance using the v1 catalog API, it records the following information about each instance: | ||
|
|
||
| | v1 Catalog field | Description | Source | | ||
| | :--------------- | :---------- | :----- | | ||
| | ID | A unique identifier for a service instance. | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Node | The connection point where the service is available. | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Address | The address of the node where the service instance is running. | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Tagged Addresses | User-defined metadata about addresses. | Defined by user | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | NodeMeta | User-defined metadata about the node. | Defined by user | | ||
| | Datacenter | The name of the datacenter the service is registered in. | Defined by user | | ||
| | Service | The name of the service Consul registers the service instance under. | Defined by user | | ||
| | Agent Check | The health status of service last reported by the Consul agent. | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Health Checks | The health checks defined for the service. Refer to [define health checks](/consul/docs/services/usage/checks) for more information. | Defined by user | | ||
|
boruszak marked this conversation as resolved.
|
||
| | Partition | The name of the admin partition the service is registered in. Refer to [admin partitions](/consul/docs/enterprise/admin-partitions) for more information. | Defined by user | | ||
| | Locality | Region and availability zone of the service. Refer to [`locality`](/consul/docs/agent/config/config-files#locality) for more information. | Defined by user | | ||
|
|
||
| Depending on the configuration entries or custom resource definitions you apply to your Consul installation, additional information such as [proxy default behavior](/consul/docs/connect/config-entries/proxy-defaults) is automatically recorded to the catalog for services. You can return this information using the [`/catalog` HTTP API endpoint](/consul/api-docs/catalog). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| --- | ||
| layout: docs | ||
| page_title: v2 Catalog API | ||
| description: Learn about version 2 of the Consul catalog, which uses GAMMA specified resources. Learn how the v2 catalog corresponds to the v1 catalog and Kubernetes resources.. | ||
| --- | ||
|
|
||
| # v2 Catalog API | ||
|
|
||
| <Warning> | ||
| The v2 catalog API is in a beta release for testing and development purposes. Do not use the v2 catalog or multi-port services in secure production environments. | ||
| </Warning> | ||
|
boruszak marked this conversation as resolved.
|
||
|
|
||
| This topic provides conceptual information about version 2 of the Consul Catalog API. The catalog tracks registered services and their locations for both service discovery and service mesh use cases. | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| Consul supports the v2 catalog on Kubernetes deployments only. For more information about Consul’s default catalog, refer to [v1 Catalog API](/consul/docs/architecture/catalog/v1). | ||
|
|
||
| ## Introduction | ||
|
|
||
| When Consul registers services, it records [user-defined and Consul-assigned information](/consul/docs/architecture/catalog/v1#catalog-structure). To determine a service’s identity, v1 of the catalog API records the following information: | ||
|
|
||
| - IDs of the specific _service instances_ that are registered | ||
| - Locations of the _nodes_ the instances run on | ||
| - Names of the _services_ the instances are associated with | ||
|
|
||
| This information enables Consul to associate service names with the individual instances and their unique network addresses, and it is essential to Consul’s service discovery and service mesh operations. | ||
|
|
||
| The [Consul v1 Catalog API](/consul/docs/architecture/catalog/v1) was designed prior to the introduction of Consul’s service mesh features. Communication in Consul’s service mesh is secured through Consul's ACL system, which requires that a Kubernetes ServiceAccount resource match the Service name. As a result, only one service can represent a Kubernetes Workload in the v1 catalog. | ||
|
boruszak marked this conversation as resolved.
Outdated
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| Since then, the cloud networking needs for applications have evolved and workarounds were developed. For example, [Kubernetes Pods with multiple ports](/consul/docs/k8s/connect#kubernetes-pods-with-multiple-ports) demonstrates how you can schedule a service with multiple ports so that Consul registers it in the catalog as distinct services with their own service instances. However, this workaround results in additional resource consumption because Consul requires that each service and port use their own proxy and Consul dataplane so that it can recognize them as distinct services. | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| The v2 catalog API is available alongside the existing v1 catalog API, but the catalogs cannot be used simultaneously. The v2 catalog is disabled by default. This beta release is for testing and development purposes only. We do not recommend implementing v2 in production environments or migrating to v2 until the API is generally available. | ||
|
|
||
| ## Catalog structure | ||
|
|
||
| Consul v1.17 introduces a new version of the catalog API designed to bridge differences between the Consul and Kubernetes data models. The v2 catalog API still tracks services and nodes for Consul, but replaces service instances with _workloads_ and _workload identites_. | ||
|
|
||
| The following table describes resources in the v2 catalog and compares them to the v1 catalog and Kubernetes resources. It also states whether these resources are defined by the user or computed by Consul when it registers a service. | ||
|
|
||
| | v2 Catalog resource | Description | Catalog v1 resource analogue | Kubernetes resource analogue | Source | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | :------------------ | :---------- | :--------------------------- | :--------------------------- | :----- | | ||
| | Service | The name of the service Consul registers a workload under | Service | None | Defined by user in Kubernetes | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Node | The address of the node where the workload runs. | Node | Node | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Workload | An application instance running in a set of one or more Pods scheduled according to a Kubernetes Workload resource such as a Deployment or StatefulSet. | Service instance | Kubernetes Workloads | Defined by user in Kubernetes | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Workload identities | Provides a distinct identity for a Kubernetes Workload to assume in a Kubernetes cluster. | Service instance | Kubernetes Service Accounts | Defin by user in Kubernetes | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Service endpoints | Maps services to workload addresses and endpoints. | None | Service backend | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Health status | A resource for reporting the health status of a workload | Agent check | None | Computed by Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
boruszak marked this conversation as resolved.
Outdated
|
||
| | Health check | A resource for defining the health checks for a workload. | Health check | Liveness, Readiness, and Startup Probes | Defined by user in Kubernetes | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| | Proxy configuration | Represents a configuration for a sidecar or gateway proxy. | `Proxy` field in service definition | None | Defined by user in Consul | | ||
| | Destinations | Represents explicit service upstreams | None | Upstream Service annotation | Defined by user in Kubernetes | | ||
|
boruszak marked this conversation as resolved.
Outdated
boruszak marked this conversation as resolved.
Outdated
|
||
| | Traffic permissions | Enables L4 traffic authorization according to workload identity instead of service identity. | Service intentions | None | Defined by user in Consul | | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| Refer to [`consul resource`](/consul/docs/k8s/multiport/reference/resource-command) for more information about using the Consul CLI to interact with the v2 catalog. | ||
|
|
||
| ## Changes to Consul’s existing architecture | ||
|
|
||
| The change in data models introduced by the v2 Catalog API impacts several aspects of Consul’s operations. | ||
|
|
||
| ### Traffic permissions resource replaces service intentions | ||
|
|
||
| The most significant change to Consul’s architecture and operations when using the v2 catalog structure is the introduction of the TrafficPermissions resource. This resource replaces the service intentions configuration entry, and enables authorized service-to-service communication for both L4 and L7 applications. | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| For more information about this resource, including example configurations, refer to [TrafficPermissions configuration reference](/consul/docs/k8s/multiport/reference/trafficpermissions). | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### HTTPRoute and GRPCRoute resources for L7 traffic management | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
|
|
||
| You can configure L7 traffic management behavior, such as service splitting, in an `HTTPRoute` or a `GRPCRoute` resource. In the v1 catalog, this behavior is defined in dedicated configuration entries. For examples, refer to [service splitter configuration entry reference](/consul/docs/connect/config-entries/service-splitter#examples). | ||
|
|
||
| For more information about these resource, including specifications and example configurations, refer to [HTTPRoute resource configuration reference](/consul/docs/k8s/multiport/reference/httproute) and [GRPCRoute resource configuration reference](/consul/docs/k8s/multiport/reference/grpcroute). | ||
|
|
||
| ### New proxy configuration resource | ||
|
|
||
| In the v1 catalog, a service’s sidecar proxy and its behavior is [defined in the `Proxy` field of the service definition](/consul/docs/services/usage/define-services). You can also separately [define a service mesh proxy](/consul/docs/connect/proxies/deploy-service-mesh-proxies) and [configure proxy defaults](/consul/docs/connect/config-entries/proxy-defaults). | ||
|
|
||
| The v2 catalog introduces the `ProxyConfiguration` resource, enabling the automatic configuration of sidecar proxy behavior according to Consul workload identity. Refer to [ProxyConfiguration resource configuration reference](/consul/docs/k8s/multiport/reference/proxyconfiguration) for more information. | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,18 @@ | ||
| --- | ||
| layout: docs | ||
| page_title: Multi-port services for service mesh | ||
| description: Consul on Kubernetes supports multi-port services for both service discovery and service mesh scenarios. Learn about Consul’s v2 catalog changes to support multiple ports for a service running in a single container. | ||
| page_title: Multi-port services overview | ||
| description: Consul on Kubernetes supports multi-port services for both service discovery and service mesh scenarios. Learn how Consul’s v2 catalog supports multiple ports for a service running in a single container. | ||
| --- | ||
|
|
||
| # Multi-port services for service mesh | ||
| # Multi-port services overview | ||
|
|
||
| <Warning> | ||
|
|
||
| Multi-port services are part of a beta release. This documentation supports testing and development scenarios. Do not use multi-port services or the v2 catalog API in secure production environments. | ||
|
|
||
| </Warning> | ||
|
|
||
| This topic describes changes to Consul's catalog that allow you to register a service with multiple ports on Kubernetes deployments. | ||
|
|
||
| ## Introduction | ||
|
|
||
| When Consul registers services, v1 of its catalog API tracks the following information: | ||
|
|
||
| - IDs of the specific _service instances_ that are registered | ||
| - Locations of the _nodes_ the instances run on | ||
| - Names of the _services_ the instances are associated with | ||
|
|
||
| This catalog API was designed prior to the introduction of Consul’s service mesh features. The service mesh uses Consul's ACL system, which requires a Kubernetes ServiceAccount resource to match the Service name. As a result, only one service can represent a Kubernetes Workload in the Consul catalog. | ||
|
|
||
| Since then, the cloud networking needs for applications have evolved and the Consul catalog adapted to support workarounds for these needs. For example, [Kubernetes Pods with multiple ports](/consul/docs/k8s/connect#kubernetes-pods-with-multiple-ports) demonstrates how you can schedule a service with multiple ports so that Consul registers it in the catalog as distinct services with their own service instances. However, this workaround results in additional resource consumption because Consul requires that each service and port use their own proxy and Consul dataplane so that it can recognize them as distinct services. | ||
|
|
||
| ### Catalog API v2 beta | ||
|
|
||
| Consul v1.17 introduces a new version of the catalog API designed to bridge differences between the Consul and Kubernetes data models. The v2 catalog API still tracks services and nodes for Consul, but replaces service instances with _workloads_ and _workload identites_. | ||
|
|
||
| - `Workload` is an application instance running in a set of one or more Pods scheduled according to a Kubernetes Workload resource such as a Deployment or StatefulSet. It is similar to [Kubernetes Workloads](https://kubernetes.io/docs/concepts/workloads/). | ||
| - `WorkloadIdentities` provide a distinct identity for a Workload to assume in a Kubernetes cluster. They are similar to [Kubernetes Service Accounts](https://kubernetes.io/docs/concepts/security/service-accounts/). | ||
|
|
||
| This catalog structure enables Consul to associate a single Kubernetes Workload with multiple services in its catalog. | ||
|
|
||
| The v2 catalog API also tracks the following information about services when they are registered with Consul: | ||
|
|
||
| - `ServiceEndpoints` maps services to workload addresses and endpoints. This resource is computed by Consul. | ||
| - `HealthStatus` is a resource for reporting the health status of a workload. | ||
| - `HealthCheck` is a resource for defining the health checks for a workload. | ||
| - `ProxyConfiguration` represents a configuration for a sidecar or gateway proxy, similar to the `Proxy` field in the current service definition. | ||
| - `Destinations` represents explicit service upstreams. | ||
| - `TrafficPermissions` is a replacement for the `ServiceIntentions` custom resource definition (CRD). Traffic permissions replace service intentions for all services in the v2 catalog, which enables L4 traffic authorization according to workload identity instead of service identity. | ||
|
|
||
| The v2 catalog API is available alongside the existing v1 catalog API, but the catalogs cannot be used simultaneously. The v2 catalog is disabled by default. This beta release is for testing and development purposes only. We do not recommend implementing v2 in production environments or migrating to v2 until the API is generally available. | ||
| This topic describes the process to register a service with multiple ports on Kubernetes deployments using the v2 catalog API. For information about the v2 catalog’s contents and structure, refer to [v2 catalog API](/consul/docs/architecture/catalog/v2). | ||
|
|
||
| ## Workflow | ||
|
|
||
|
|
@@ -57,13 +25,35 @@ To use a multi-port service in Consul on Kubernetes deployments, complete the fo | |
|
|
||
|
boruszak marked this conversation as resolved.
|
||
| For an example configuration and instructions for each of the steps in this workflow, refer to [configure multi-port services](/consul/docs/k8s/multiport/configure). | ||
|
|
||
| [Link to/describe advanced routing configurations re: examples on configuration pages] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checking, this is an open TODO, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep! I think some wires got crossed in communicating how I was going to create and update the pages - short version is that I needed to create the resource reference pages before I'm able to describe the workflow with them. These should be updated shortly! |
||
|
|
||
| ## Constraints and limitations | ||
|
boruszak marked this conversation as resolved.
|
||
|
|
||
| Be aware of the following constraints and technical limitations on using multi-port services and the v2 catalog API: | ||
|
|
||
| - The v2 catalog API beta does not support connections with client agents. It is only available for Kubernetes deployments, which use [Consul dataplanes](/consul/docs/connect/dataplane) instead of client agents. | ||
| - Consul client agents do not support multi-port services or the v2 catalog API beta. Kubernetes deployments support multi-port services using [Consul dataplanes](/consul/docs/connect/dataplane) instead of client agents. | ||
|
boruszak marked this conversation as resolved.
Outdated
|
||
| - The v1 and v2 catalog APIs cannot run concurrently. | ||
| - The Consul UI does not support multi-port services or the v2 catalog API in this release. You must disable the UI in the Helm chart in order to use the v2 catalog API. | ||
| - HCP Consul does not support multi-port services or the v2 catalog API in this release. You cannot [link a self-managed cluster to HCP Consul](/hcp/docs/consul/self-managed) to access its UI or view observability metrics when it uses the v2 catalog. | ||
| - The v2 catalog API does not support ACLs in the beta release. | ||
| - We do not recommend updating existing clusters to enable the v2 catalog in this release. To use the v2 catalog, deploy a new Consul cluster. | ||
| - We do not recommend updating existing clusters to enable the v2 catalog in this release. To register multi-port services, deploy a new Consul cluster that enables the v2 catalog. | ||
|
|
||
| ## Guidance | ||
|
|
||
| The following resources are available to help you use multi-port services: | ||
|
boruszak marked this conversation as resolved.
|
||
|
|
||
| ### Concepts | ||
|
|
||
| - [v2 catalog API](/consul/docs/architecture/catalog/v2) | ||
|
|
||
| ### Usage documentation | ||
|
|
||
| - [Configure multi-port services](/consul/docs/k8s/multiport/configure) | ||
|
|
||
| ### Reference documentation | ||
|
|
||
| - [`consul resource` CLI command](/consul/docs/k8s/multiport/reference/resource-command) | ||
| - [GRPCRoute configuration reference](/consul/docs/k8s/multiport/reference/grpcroute) | ||
| - [HTTPRoute configuration reference](/consul/docs/k8s/multiport/reference/httproute) | ||
| - [ProxyConfiguration configuration reference](/consul/docs/k8s/multiport/reference/proxyconfiguration) | ||
| - [TCPRoute configuration reference](/consul/docs/k8s/multiport/reference/tcproute) | ||
| - [TrafficPermissions configuration reference](/consul/docs/k8s/multiport/reference/trafficpermissions) | ||
Uh oh!
There was an error while loading. Please reload this page.