mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 17:03:31 +00:00
Merge pull request #11983 from hashicorp/resolver_examples
docs: added another resolver example for DC and namespace failover
This commit is contained in:
commit
79170d9731
@ -122,9 +122,9 @@ spec:
|
|||||||
|
|
||||||
</CodeTabs>
|
</CodeTabs>
|
||||||
|
|
||||||
### Datacenter failover
|
### Failover
|
||||||
|
|
||||||
Enable failover for subset 'v2' to 'dc2', and all other subsets to dc3 or dc4:
|
Enable failover for subset `v2` to `dc2`, and all other subsets to `dc3` or `dc4`:
|
||||||
|
|
||||||
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
|
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
|
||||||
|
|
||||||
@ -174,6 +174,104 @@ spec:
|
|||||||
|
|
||||||
</CodeTabs>
|
</CodeTabs>
|
||||||
|
|
||||||
|
<EnterpriseAlert product="consul">
|
||||||
|
Failover to another datacenter and namespace for all service subsets.
|
||||||
|
</EnterpriseAlert>
|
||||||
|
|
||||||
|
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
Kind = "service-resolver"
|
||||||
|
Name = "product-api"
|
||||||
|
Namespace = "primary"
|
||||||
|
ConnectTimeout = "0s"
|
||||||
|
Failover = {
|
||||||
|
"*" = {
|
||||||
|
Datacenters = ["dc2"]
|
||||||
|
Namespace = "secondary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: consul.hashicorp.com/v1alpha1
|
||||||
|
kind: ServiceResolver
|
||||||
|
metadata:
|
||||||
|
name: product-api
|
||||||
|
namespace: primary
|
||||||
|
spec:
|
||||||
|
connectTimeout: 0s
|
||||||
|
failover:
|
||||||
|
namespace: 'secondary'
|
||||||
|
datacenters: ['dc2']
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"Kind": "service-resolver",
|
||||||
|
"Name": "product-api",
|
||||||
|
"Namespace": "primary",
|
||||||
|
"ConnectTimeout": "0s",
|
||||||
|
"Failover": {
|
||||||
|
"*": {
|
||||||
|
"Datacenters": ["dc2"],
|
||||||
|
"Namespace": "secondary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</CodeTabs>
|
||||||
|
|
||||||
|
<EnterpriseAlert product="consul">
|
||||||
|
Failover within a datacenter and a different namespace.
|
||||||
|
</EnterpriseAlert>
|
||||||
|
|
||||||
|
<CodeTabs tabs={[ "HCL", "Kubernetes YAML", "JSON" ]}>
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
Kind = "service-resolver"
|
||||||
|
Name = "product-api"
|
||||||
|
Namespace = "primary"
|
||||||
|
ConnectTimeout = "0s"
|
||||||
|
Failover = {
|
||||||
|
"*" = {
|
||||||
|
Service = "product-api-backup"
|
||||||
|
Namespace = "secondary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: consul.hashicorp.com/v1alpha1
|
||||||
|
kind: ServiceResolver
|
||||||
|
metadata:
|
||||||
|
name: product-api
|
||||||
|
namespace: primary
|
||||||
|
spec:
|
||||||
|
connectTimeout: 0s
|
||||||
|
failover:
|
||||||
|
service: 'product-api-backup'
|
||||||
|
namespace: 'secondary'
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"Kind": "service-resolver",
|
||||||
|
"Name": "product-api",
|
||||||
|
"Namespace": "primary",
|
||||||
|
"ConnectTimeout": "0s",
|
||||||
|
"Failover": {
|
||||||
|
"*": {
|
||||||
|
"Service": "product-api-backup",
|
||||||
|
"Namespace": "secondary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</CodeTabs>
|
||||||
|
|
||||||
### Consistent load balancing
|
### Consistent load balancing
|
||||||
|
|
||||||
Apply consistent load balancing for requests based on `x-user-id` header:
|
Apply consistent load balancing for requests based on `x-user-id` header:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user