Update annotations-and-labels.mdx

pull/18032/head
David Yu 2023-07-06 11:34:23 -07:00 committed by GitHub
parent f2b6fa7b43
commit 83b84a985a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 13 deletions

View File

@ -12,8 +12,11 @@ description: >-
Consul on Kubernetes provides a few options for customizing how connect-inject behavior should be configured. Consul on Kubernetes provides a few options for customizing how connect-inject behavior should be configured.
This allows the user to configure natively configure Consul on select Kubernetes resources (i.e. pods, services). This allows the user to configure natively configure Consul on select Kubernetes resources (i.e. pods, services).
- [Annotations](#annotations) - [Consul Service Mesh](#consul-service-mesh)
- [Labels](#labels) - [Annotations](#annotations)
- [Labels](#labels)
- [Service Sync](#service-sync)
- [Annotations](#service-sync-annotations)
The noun _connect_ is used throughout this documentation to refer to the connect The noun _connect_ is used throughout this documentation to refer to the connect
subsystem that provides Consul's service mesh capabilities. subsystem that provides Consul's service mesh capabilities.
@ -278,30 +281,30 @@ Resource labels could be used on a Kubernetes service to control connect-inject
registration to ignore all services except for the one which should be used for routing requests registration to ignore all services except for the one which should be used for routing requests
using Consul. using Consul.
## Consul Service Sync ## Service Sync
### Annotations ### Annotations
The following Kubernetes resource annotations could be used on a pod to [Service Sync](https://developer.hashicorp.com/consul/docs/k8s/service-sync) behavior: The following Kubernetes resource annotations could be used on a pod to [Service Sync](https://developer.hashicorp.com/consul/docs/k8s/service-sync) behavior:
- 'consul.hashicorp.com/service-sync': If this is set to `true`, then the Kubernetes service is explicitly configured to be synced to Consul. - `consul.hashicorp.com/service-sync`: If this is set to `true`, then the Kubernetes service is explicitly configured to be synced to Consul.
- 'consul.hashicorp.com/service-port': Configures the port to register to the Consul Catalog for the Kubernetes service. The annotation value may be a name of a port (recommended) or an exact port value. See [service ports](https://developer.hashicorp.com/consul/docs/k8s/service-sync#service-ports) for more information.
- `consul.hashicorp.com/service-port`: Configures the port to register to the Consul Catalog for the Kubernetes service. The annotation value may be a name of a port (recommended) or an exact port value. See [service ports](https://developer.hashicorp.com/consul/docs/k8s/service-sync#service-ports) for more information.
```yaml ```yaml
annotations: annotations:
'consul.hashicorp.com/service-port': 'http' 'consul.hashicorp.com/service-port': 'http'
``` ```
- 'consul.hashicorp.com/service-tags': A comma separated list of strings (without whitespace) to use for registering tags to the service registered to Consul. These custom tags automatically include the `k8s` tag which can't be disabled. - `consul.hashicorp.com/service-tags`: A comma separated list of strings (without whitespace) to use for registering tags to the service registered to Consul. These custom tags automatically include the `k8s` tag which can't be disabled.
```yaml ```yaml
annotations: annotations:
'consul.hashicorp.com/service-tags': 'primary,foo' 'consul.hashicorp.com/service-tags': 'primary,foo'
``` ```
- 'consul.hashicorp.com/service-meta': A map for specifying service metadata for Consul services. The "KEY" below can be set to any key. This allows setting multiple meta values. - `consul.hashicorp.com/service-meta`: A map for specifying service metadata for Consul services. The "KEY" below can be set to any key. This allows setting multiple meta values.
```yaml ```yaml
annotations: annotations:
'consul.hashicorp.com/service-meta-KEY': 'value' 'consul.hashicorp.com/service-meta-KEY': 'value'
``` ```
- `consul.hashicorp.com/service-weight:` - Configure ability to support weighted loadbalancing by service annotation for Catalog Sync. The integer provided will be applied as a weight for the `passing` state for the health of the service. See [weights](/consul/docs/services/configuration/services-configuration-reference#weights) in service configuration for more information on how this is leveraged for services in the Consul catalog. - `consul.hashicorp.com/service-weight:` - Configure ability to support weighted loadbalancing by service annotation for Catalog Sync. The integer provided will be applied as a weight for the `passing` state for the health of the service. See [weights](/consul/docs/services/configuration/services-configuration-reference#weights) in service configuration for more information on how this is leveraged for services in the Consul catalog.