mirror of https://github.com/status-im/consul.git
Traffic Management
This commit is contained in:
parent
3e2a650e5f
commit
66f8c65e89
|
@ -374,3 +374,58 @@ Next to the name of the peer, click **More** (three horizontal dots) and then **
|
||||||
|
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
|
## Traffic nanagement between peers
|
||||||
|
|
||||||
|
As of Consul v1.14, you can use [dynamic traffic management](/consul/docs/connect/l7-traffic) to configure your service mesh so that services automatically failover and redirect between peers. The following examples updates the [ServiceResolver config entry](/docs/connect/config-entries/) in `cluster-01` so that Consul redirects traffic intended for the `frontend` service to a backup instance in peer `cluster-02` when it detects multiple connection failures.
|
||||||
|
|
||||||
|
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
Kind = "service-resolver"
|
||||||
|
Name = "frontend"
|
||||||
|
ConnectTimeout = "15s"
|
||||||
|
Failover = {
|
||||||
|
"*" = {
|
||||||
|
Targets = [
|
||||||
|
{Peer = "cluster-02"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: consul.hashicorp.com/v1alpha1
|
||||||
|
kind: ServiceResolver
|
||||||
|
metadata:
|
||||||
|
name: frontend
|
||||||
|
spec:
|
||||||
|
connectTimeout: 15s
|
||||||
|
failover:
|
||||||
|
'*':
|
||||||
|
targets:
|
||||||
|
- peer: 'cluster-02'
|
||||||
|
service: 'backup'
|
||||||
|
namespace: 'default'
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"ConnectTimeout": "15s",
|
||||||
|
"Kind": "service-resolver",
|
||||||
|
"Name": "frontend",
|
||||||
|
"Failover": {
|
||||||
|
"*": {
|
||||||
|
"Targets": [
|
||||||
|
{
|
||||||
|
"Peer": "cluster-02"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CreateIndex": 250,
|
||||||
|
"ModifyIndex": 250
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</CodeTabs>
|
|
@ -437,9 +437,9 @@ To recreate or reset the peering connection, you need to generate a new peering
|
||||||
|
|
||||||
## Traffic management between peers
|
## Traffic management between peers
|
||||||
|
|
||||||
As of Consul v1.14, you can use dynamic traffic management features to configure your service mesh so that services automatically failover and redirect between peers.
|
As of Consul v1.14, you can use [dynamic traffic management](/consul/docs/connect/l7-traffic) to configure your service mesh so that services automatically failover and redirect between peers.
|
||||||
|
|
||||||
To configure automatic service failovers and redirect, edit the `ServiceResolver` CRD so that traffic resolves to a backup service instance on a peer. The following example updates the `ServiceResolver` CRD in `cluster-02` so that Consul redirects traffic intended for the `backend` service to a backup instance in `cluster-01` when it detects multiple connection failures to the primary instance.
|
To configure automatic service failovers and redirect, edit the `ServiceResolver` CRD so that traffic resolves to a backup service instance on a peer. The following example updates the `ServiceResolver` CRD in `cluster-01` so that Consul redirects traffic intended for the `frontend` service to a backup instance in `cluster-02` when it detects multiple connection failures to the primary instance.
|
||||||
|
|
||||||
<CodeBlockConfig filename="service-resolver.yaml" hideClipboard>
|
<CodeBlockConfig filename="service-resolver.yaml" hideClipboard>
|
||||||
|
|
||||||
|
@ -447,13 +447,13 @@ To configure automatic service failovers and redirect, edit the `ServiceResolver
|
||||||
apiVersion: consul.hashicorp.com/v1alpha1
|
apiVersion: consul.hashicorp.com/v1alpha1
|
||||||
kind: ServiceResolver
|
kind: ServiceResolver
|
||||||
metadata:
|
metadata:
|
||||||
name: backend
|
name: frontend
|
||||||
spec:
|
spec:
|
||||||
connectTimeout: 15s
|
connectTimeout: 15s
|
||||||
failover:
|
failover:
|
||||||
'*':
|
'*':
|
||||||
targets:
|
targets:
|
||||||
- peer: 'cluster-01'
|
- peer: 'cluster-02'
|
||||||
service: 'backup'
|
service: 'backup'
|
||||||
namespace: 'default'
|
namespace: 'default'
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue