Skip to content

Commit f3e3d2c

Browse files
Tim Bannisterzacharysarah
andcommitted
Reword in line with style guide
Co-authored-by: ZSC <[email protected]>
1 parent 664de5d commit f3e3d2c

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

content/en/docs/tasks/run-application/run-replicated-stateful-application.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ weight: 30
1414
<!-- overview -->
1515

1616
This page shows how to run a replicated stateful application using a
17-
[StatefulSet](/docs/concepts/workloads/controllers/statefulset/) controller.
17+
{{< glossary_tooltip term_id="statefulset" >}}.
1818
This application is a replicated MySQL database. The example topology has a
1919
single primary server and multiple replicas, using asynchronous row-based
2020
replication.
@@ -27,7 +27,7 @@ on general patterns for running stateful applications in Kubernetes.
2727
## {{% heading "prerequisites" %}}
2828

2929

30-
* {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
30+
* {{< include "task-tutorial-prereqs.md" >}}
3131
* {{< include "default-storage-class-prereqs.md" >}}
3232
* This tutorial assumes you are familiar with
3333
[PersistentVolumes](/docs/concepts/storage/persistent-volumes/)
@@ -44,7 +44,7 @@ on general patterns for running stateful applications in Kubernetes.
4444
## {{% heading "objectives" %}}
4545

4646

47-
* Deploy a replicated MySQL topology with a StatefulSet controller.
47+
* Deploy a replicated MySQL topology with a StatefulSet.
4848
* Send MySQL client traffic.
4949
* Observe resistance to downtime.
5050
* Scale the StatefulSet up and down.
@@ -58,7 +58,7 @@ on general patterns for running stateful applications in Kubernetes.
5858
The example MySQL deployment consists of a ConfigMap, two Services,
5959
and a StatefulSet.
6060

61-
### ConfigMap
61+
### Create a ConfigMap {#configmap}
6262

6363
Create the ConfigMap from the following YAML configuration file:
6464

@@ -78,7 +78,7 @@ portions to apply to different Pods.
7878
Each Pod decides which portion to look at as it's initializing,
7979
based on information provided by the StatefulSet controller.
8080

81-
### Services
81+
### Create Services {#services}
8282

8383
Create the Services from the following YAML configuration file:
8484

@@ -88,23 +88,24 @@ Create the Services from the following YAML configuration file:
8888
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-services.yaml
8989
```
9090

91-
The Headless Service provides a home for the DNS entries that the StatefulSet
92-
controller creates for each Pod that's part of the set.
93-
Because the Headless Service is named `mysql`, the Pods are accessible by
91+
The headless Service provides a home for the DNS entries that the StatefulSet
92+
{{< glossary_tooltip text="controllers" term_id="controller" >}} creates for each
93+
Pod that's part of the set.
94+
Because the headless Service is named `mysql`, the Pods are accessible by
9495
resolving `<pod-name>.mysql` from within any other Pod in the same Kubernetes
9596
cluster and namespace.
9697

97-
The Client Service, called `mysql-read`, is a normal Service with its own
98+
The client Service, called `mysql-read`, is a normal Service with its own
9899
cluster IP that distributes connections across all MySQL Pods that report
99100
being Ready. The set of potential endpoints includes the primary MySQL server and all
100101
replicas.
101102

102-
Note that only read queries can use the load-balanced Client Service.
103+
Note that only read queries can use the load-balanced client Service.
103104
Because there is only one primary MySQL server, clients should connect directly to the
104-
primary MySQL Pod (through its DNS entry within the Headless Service) to execute
105+
primary MySQL Pod (through its DNS entry within the headless Service) to execute
105106
writes.
106107

107-
### StatefulSet
108+
### Create the StatefulSet {#statefulset}
108109

109110
Finally, create the StatefulSet from the following YAML configuration file:
110111

@@ -120,7 +121,7 @@ You can watch the startup progress by running:
120121
kubectl get pods -l app=mysql --watch
121122
```
122123

123-
After a while, you should see all 3 Pods become Running:
124+
After a while, you should see all 3 Pods become `Running`:
124125

125126
```
126127
NAME READY STATUS RESTARTS AGE
@@ -156,19 +157,18 @@ properties to perform orderly startup of MySQL replication.
156157
### Generating configuration
157158

158159
Before starting any of the containers in the Pod spec, the Pod first runs any
159-
[Init Containers](/docs/concepts/workloads/pods/init-containers/)
160+
[init containers](/docs/concepts/workloads/pods/init-containers/)
160161
in the order defined.
161162

162-
The first Init Container, named `init-mysql`, generates special MySQL config
163+
The first init container, named `init-mysql`, generates special MySQL config
163164
files based on the ordinal index.
164165

165166
The script determines its own ordinal index by extracting it from the end of
166167
the Pod name, which is returned by the `hostname` command.
167168
Then it saves the ordinal (with a numeric offset to avoid reserved values)
168169
into a file called `server-id.cnf` in the MySQL `conf.d` directory.
169170
This translates the unique, stable identity provided by the StatefulSet
170-
controller into the domain of MySQL server IDs, which require the same
171-
properties.
171+
into the domain of MySQL server IDs, which require the same properties.
172172

173173
The script in the `init-mysql` container also applies either `primary.cnf` or
174174
`replica.cnf` from the ConfigMap by copying the contents into `conf.d`.
@@ -188,7 +188,7 @@ logs might not go all the way back to the beginning of time.
188188
These conservative assumptions are the key to allow a running StatefulSet
189189
to scale up and down over time, rather than being fixed at its initial size.
190190

191-
The second Init Container, named `clone-mysql`, performs a clone operation on
191+
The second init container, named `clone-mysql`, performs a clone operation on
192192
a replica Pod the first time it starts up on an empty PersistentVolume.
193193
That means it copies all existing data from another running Pod,
194194
so its local state is consistent enough to begin replicating from the primary server.
@@ -203,7 +203,7 @@ Ready before starting Pod `N+1`.
203203

204204
### Starting replication
205205

206-
After the Init Containers complete successfully, the regular containers run.
206+
After the init containers complete successfully, the regular containers run.
207207
The MySQL Pods consist of a `mysql` container that runs the actual `mysqld`
208208
server, and an `xtrabackup` container that acts as a
209209
[sidecar](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns).
@@ -292,13 +292,13 @@ endpoint might be selected upon each connection attempt:
292292
You can press **Ctrl+C** when you want to stop the loop, but it's useful to keep
293293
it running in another window so you can see the effects of the following steps.
294294

295-
## Simulating Pod and Node downtime
295+
## Simulate Pod and Node failure {#simulate-pod-and-node-downtime}
296296

297297
To demonstrate the increased availability of reading from the pool of replicas
298298
instead of a single server, keep the `SELECT @@server_id` loop from above
299299
running while you force a Pod out of the Ready state.
300300

301-
### Break the Readiness Probe
301+
### Break the Readiness probe
302302

303303
The [readiness probe](/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes)
304304
for the `mysql` container runs the command `mysql -h 127.0.0.1 -e 'SELECT 1'`
@@ -372,13 +372,13 @@ NAME READY STATUS RESTARTS AGE IP NODE
372372
mysql-2 2/2 Running 0 15m 10.244.5.27 kubernetes-node-9l2t
373373
```
374374

375-
Then drain the Node by running the following command, which cordons it so
375+
Then, drain the Node by running the following command, which cordons it so
376376
no new Pods may schedule there, and then evicts any existing Pods.
377377
Replace `<node-name>` with the name of the Node you found in the last step.
378378

379379
{{< caution >}}
380-
Draining a Node can impact other workloads and applications that are
381-
running on the same node, so only do the following step in a test
380+
Draining a Node can impact other workloads and applications
381+
running on the same node. Only perform the following step in a test
382382
cluster.
383383
{{< /caution >}}
384384

0 commit comments

Comments
 (0)