Skip to content

Commit d128777

Browse files
authored
Merge pull request #850 from Evalle/ISSUE-844-2
ISSUE-844: Doc: update failure domains doc
2 parents a4e0b70 + ef30b32 commit d128777

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed

docs/topics/failure-domains.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,84 @@ Full details of availability zones, regions can be found in the [Azure docs](htt
1414

1515
### Default Behaviour
1616

17-
The default behaviour of Cluster API is to try and spread machines out across all the failure domains. The controller for the `AzureCluster` queries the Resource Manager API for the availability zones for the **Location** of the cluster. The availability zones are reported back to Cluster API via the **FailureDomains** field in the status of `AzureCluster`.
17+
By default, only control plane machines get automatically spread to all cluster zones. A workaround for spreading worker machines is to create N `MachineDelpoyments` for your N failure domains, scaling them independently. Resiliency to failures comes through having multiple `MachineDeployments` (see below).
18+
19+
```yaml
20+
apiVersion: cluster.x-k8s.io/v1alpha3
21+
kind: MachineDeployment
22+
metadata:
23+
name: ${CLUSTER_NAME}-md-0
24+
namespace: default
25+
spec:
26+
clusterName: ${CLUSTER_NAME}
27+
replicas: ${WORKER_MACHINE_COUNT}
28+
selector:
29+
matchLabels: null
30+
template:
31+
spec:
32+
bootstrap:
33+
configRef:
34+
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
35+
kind: KubeadmConfigTemplate
36+
name: ${CLUSTER_NAME}-md-0
37+
clusterName: ${CLUSTER_NAME}
38+
infrastructureRef:
39+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
40+
kind: AzureMachineTemplate
41+
name: ${CLUSTER_NAME}-md-0
42+
version: ${KUBERNETES_VERSION}
43+
failureDomain: "1"
44+
---
45+
apiVersion: cluster.x-k8s.io/v1alpha3
46+
kind: MachineDeployment
47+
metadata:
48+
name: ${CLUSTER_NAME}-md-1
49+
namespace: default
50+
spec:
51+
clusterName: ${CLUSTER_NAME}
52+
replicas: ${WORKER_MACHINE_COUNT}
53+
selector:
54+
matchLabels: null
55+
template:
56+
spec:
57+
bootstrap:
58+
configRef:
59+
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
60+
kind: KubeadmConfigTemplate
61+
name: ${CLUSTER_NAME}-md-1
62+
clusterName: ${CLUSTER_NAME}
63+
infrastructureRef:
64+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
65+
kind: AzureMachineTemplate
66+
name: ${CLUSTER_NAME}-md-1
67+
version: ${KUBERNETES_VERSION}
68+
failureDomain: "2"
69+
---
70+
apiVersion: cluster.x-k8s.io/v1alpha3
71+
kind: MachineDeployment
72+
metadata:
73+
name: ${CLUSTER_NAME}-md-2
74+
namespace: default
75+
spec:
76+
clusterName: ${CLUSTER_NAME}
77+
replicas: ${WORKER_MACHINE_COUNT}
78+
selector:
79+
matchLabels: null
80+
template:
81+
spec:
82+
bootstrap:
83+
configRef:
84+
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
85+
kind: KubeadmConfigTemplate
86+
name: ${CLUSTER_NAME}-md-2
87+
clusterName: ${CLUSTER_NAME}
88+
infrastructureRef:
89+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
90+
kind: AzureMachineTemplate
91+
name: ${CLUSTER_NAME}-md-2
92+
version: ${KUBERNETES_VERSION}
93+
failureDomain: "3"
94+
```
1895
1996
The Cluster API controller will look for the **FailureDomains** status field and will set the **FailureDomain** field in a `Machine` if a value hasn't already been explicitly set. It will try to ensure that the machines are spread across all the failure domains.
2097

0 commit comments

Comments
 (0)