Skip to content

Commit ba99616

Browse files
committed
Clean up page in tasks/run-application
1 parent 448e1fa commit ba99616

7 files changed

+141
-165
lines changed

content/en/docs/tasks/run-application/access-api-from-pod.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ libraries can automatically discover the API server and authenticate.
2727

2828
From within a Pod, the recommended ways to connect to the Kubernetes API are:
2929

30-
- For a Go client, use the official [Go client library](https://github.com/kubernetes/client-go/).
31-
The `rest.InClusterConfig()` function handles API host discovery and authentication automatically.
32-
See [an example here](https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go).
30+
- For a Go client, use the official
31+
[Go client library](https://github.com/kubernetes/client-go/).
32+
The `rest.InClusterConfig()` function handles API host discovery and authentication automatically.
33+
See [an example here](https://git.k8s.io/client-go/examples/in-cluster-client-configuration/main.go).
3334

34-
- For a Python client, use the official [Python client library](https://github.com/kubernetes-client/python/).
35-
The `config.load_incluster_config()` function handles API host discovery and authentication automatically.
36-
See [an example here](https://github.com/kubernetes-client/python/blob/master/examples/in_cluster_config.py).
35+
- For a Python client, use the official
36+
[Python client library](https://github.com/kubernetes-client/python/).
37+
The `config.load_incluster_config()` function handles API host discovery and authentication automatically.
38+
See [an example here](https://github.com/kubernetes-client/python/blob/master/examples/in_cluster_config.py).
3739

38-
- There are a number of other libraries available, please refer to the [Client Libraries](/docs/reference/using-api/client-libraries/) page.
40+
- There are a number of other libraries available, please refer to the
41+
[Client Libraries](/docs/reference/using-api/client-libraries/) page.
3942

4043
In each case, the service account credentials of the Pod are used to communicate
4144
securely with the API server.
@@ -50,7 +53,7 @@ Service named `kubernetes` in the `default` namespace so that pods may reference
5053

5154
{{< note >}}
5255
Kubernetes does not guarantee that the API server has a valid certificate for
53-
the hostname `kubernetes.default.svc`;
56+
the hostname `kubernetes.default.svc`;
5457
however, the control plane **is** expected to present a valid certificate for the
5558
hostname or IP address that `$KUBERNETES_SERVICE_HOST` represents.
5659
{{< /note >}}
@@ -80,7 +83,7 @@ in the Pod can use it directly.
8083
### Without using a proxy
8184

8285
It is possible to avoid using the kubectl proxy by passing the authentication token
83-
directly to the API server. The internal certificate secures the connection.
86+
directly to the API server. The internal certificate secures the connection.
8487

8588
```shell
8689
# Point to the internal API server hostname
@@ -107,9 +110,7 @@ The output will be similar to this:
107110
```json
108111
{
109112
"kind": "APIVersions",
110-
"versions": [
111-
"v1"
112-
],
113+
"versions": ["v1"],
113114
"serverAddressByClientCIDRs": [
114115
{
115116
"clientCIDR": "0.0.0.0/0",

content/en/docs/tasks/run-application/configure-pdb.md

+30-36
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@ that your application experiences, allowing for higher availability
1414
while permitting the cluster administrator to manage the clusters
1515
nodes.
1616

17-
18-
1917
## {{% heading "prerequisites" %}}
2018

2119
{{< version-check >}}
2220

23-
* You are the owner of an application running on a Kubernetes cluster that requires
21+
- You are the owner of an application running on a Kubernetes cluster that requires
2422
high availability.
25-
* You should know how to deploy [Replicated Stateless Applications](/docs/tasks/run-application/run-stateless-application-deployment/)
23+
- You should know how to deploy [Replicated Stateless Applications](/docs/tasks/run-application/run-stateless-application-deployment/)
2624
and/or [Replicated Stateful Applications](/docs/tasks/run-application/run-replicated-stateful-application/).
27-
* You should have read about [Pod Disruptions](/docs/concepts/workloads/pods/disruptions/).
28-
* You should confirm with your cluster owner or service provider that they respect
25+
- You should have read about [Pod Disruptions](/docs/concepts/workloads/pods/disruptions/).
26+
- You should confirm with your cluster owner or service provider that they respect
2927
Pod Disruption Budgets.
3028

31-
3229
<!-- steps -->
3330

3431
## Protecting an Application with a PodDisruptionBudget
@@ -38,8 +35,6 @@ nodes.
3835
1. Create a PDB definition as a YAML file.
3936
1. Create the PDB object from the YAML file.
4037

41-
42-
4338
<!-- discussion -->
4439

4540
## Identify an Application to Protect
@@ -61,29 +56,28 @@ You can also use PDBs with pods which are not controlled by one of the above
6156
controllers, or arbitrary groups of pods, but there are some restrictions,
6257
described in [Arbitrary Controllers and Selectors](#arbitrary-controllers-and-selectors).
6358

64-
6559
## Think about how your application reacts to disruptions
6660

6761
Decide how many instances can be down at the same time for a short period
6862
due to a voluntary disruption.
6963

7064
- Stateless frontends:
71-
- Concern: don't reduce serving capacity by more than 10%.
65+
- Concern: don't reduce serving capacity by more than 10%.
7266
- Solution: use PDB with minAvailable 90% for example.
7367
- Single-instance Stateful Application:
7468
- Concern: do not terminate this application without talking to me.
7569
- Possible Solution 1: Do not use a PDB and tolerate occasional downtime.
76-
- Possible Solution 2: Set PDB with maxUnavailable=0. Have an understanding
70+
- Possible Solution 2: Set PDB with maxUnavailable=0. Have an understanding
7771
(outside of Kubernetes) that the cluster operator needs to consult you before
78-
termination. When the cluster operator contacts you, prepare for downtime,
79-
and then delete the PDB to indicate readiness for disruption. Recreate afterwards.
72+
termination. When the cluster operator contacts you, prepare for downtime,
73+
and then delete the PDB to indicate readiness for disruption. Recreate afterwards.
8074
- Multiple-instance Stateful application such as Consul, ZooKeeper, or etcd:
8175
- Concern: Do not reduce number of instances below quorum, otherwise writes fail.
8276
- Possible Solution 1: set maxUnavailable to 1 (works with varying scale of application).
83-
- Possible Solution 2: set minAvailable to quorum-size (e.g. 3 when scale is 5). (Allows more disruptions at once).
77+
- Possible Solution 2: set minAvailable to quorum-size (e.g. 3 when scale is 5). (Allows more disruptions at once).
8478
- Restartable Batch Job:
8579
- Concern: Job needs to complete in case of voluntary disruption.
86-
- Possible solution: Do not create a PDB. The Job controller will create a replacement pod.
80+
- Possible solution: Do not create a PDB. The Job controller will create a replacement pod.
8781

8882
### Rounding logic when specifying percentages
8983

@@ -103,25 +97,25 @@ that controls this behavior.
10397

10498
## Specifying a PodDisruptionBudget
10599

106-
A `PodDisruptionBudget` has three fields:
100+
A `PodDisruptionBudget` has three fields:
107101

108-
* A label selector `.spec.selector` to specify the set of
109-
pods to which it applies. This field is required.
110-
* `.spec.minAvailable` which is a description of the number of pods from that
111-
set that must still be available after the eviction, even in the absence
112-
of the evicted pod. `minAvailable` can be either an absolute number or a percentage.
113-
* `.spec.maxUnavailable` (available in Kubernetes 1.7 and higher) which is a description
114-
of the number of pods from that set that can be unavailable after the eviction.
115-
It can be either an absolute number or a percentage.
102+
- A label selector `.spec.selector` to specify the set of
103+
pods to which it applies. This field is required.
104+
- `.spec.minAvailable` which is a description of the number of pods from that
105+
set that must still be available after the eviction, even in the absence
106+
of the evicted pod. `minAvailable` can be either an absolute number or a percentage.
107+
- `.spec.maxUnavailable` (available in Kubernetes 1.7 and higher) which is a description
108+
of the number of pods from that set that can be unavailable after the eviction.
109+
It can be either an absolute number or a percentage.
116110

117111
{{< note >}}
118112
The behavior for an empty selector differs between the policy/v1beta1 and policy/v1 APIs for
119113
PodDisruptionBudgets. For policy/v1beta1 an empty selector matches zero pods, while
120114
for policy/v1 an empty selector matches every pod in the namespace.
121115
{{< /note >}}
122116

123-
You can specify only one of `maxUnavailable` and `minAvailable` in a single `PodDisruptionBudget`.
124-
`maxUnavailable` can only be used to control the eviction of pods
117+
You can specify only one of `maxUnavailable` and `minAvailable` in a single `PodDisruptionBudget`.
118+
`maxUnavailable` can only be used to control the eviction of pods
125119
that have an associated controller managing them. In the examples below, "desired replicas"
126120
is the `scale` of the controller managing the pods being selected by the
127121
`PodDisruptionBudget`.
@@ -130,20 +124,20 @@ Example 1: With a `minAvailable` of 5, evictions are allowed as long as they lea
130124
5 or more [healthy](#healthiness-of-a-pod) pods among those selected by the PodDisruptionBudget's `selector`.
131125

132126
Example 2: With a `minAvailable` of 30%, evictions are allowed as long as at least 30%
133-
of the number of desired replicas are healthy.
127+
of the number of desired replicas are healthy.
134128

135129
Example 3: With a `maxUnavailable` of 5, evictions are allowed as long as there are at most 5
136130
unhealthy replicas among the total number of desired replicas.
137131

138-
Example 4: With a `maxUnavailable` of 30%, evictions are allowed as long as no more than 30%
132+
Example 4: With a `maxUnavailable` of 30%, evictions are allowed as long as no more than 30%
139133
of the desired replicas are unhealthy.
140134

141135
In typical usage, a single budget would be used for a collection of pods managed by
142-
a controller—for example, the pods in a single ReplicaSet or StatefulSet.
136+
a controller—for example, the pods in a single ReplicaSet or StatefulSet.
143137

144138
{{< note >}}
145139
A disruption budget does not truly guarantee that the specified
146-
number/percentage of pods will always be up. For example, a node that hosts a
140+
number/percentage of pods will always be up. For example, a node that hosts a
147141
pod from the collection may fail when the collection is at the minimum size
148142
specified in the budget, thus bringing the number of available pods from the
149143
collection below the specified size. The budget can only protect against
@@ -156,7 +150,7 @@ object such as ReplicaSet, then you cannot successfully drain a Node running one
156150
If you try to drain a Node where an unevictable Pod is running, the drain never completes. This is permitted as per the
157151
semantics of `PodDisruptionBudget`.
158152

159-
You can find examples of pod disruption budgets defined below. They match pods with the label
153+
You can find examples of pod disruption budgets defined below. They match pods with the label
160154
`app: zookeeper`.
161155

162156
Example PDB Using minAvailable:
@@ -246,8 +240,8 @@ on the [API server](/docs/reference/command-line-tools-reference/kube-apiserver/
246240

247241
PodDisruptionBudget guarding an application ensures that `.status.currentHealthy` number of pods
248242
does not fall below the number specified in `.status.desiredHealthy` by disallowing eviction of healthy pods.
249-
By using `.spec.unhealthyPodEvictionPolicy`, you can also define the criteria when unhealthy pods
250-
should be considered for eviction. The default behavior when no policy is specified corresponds
243+
By using `.spec.unhealthyPodEvictionPolicy`, you can also define the criteria when unhealthy pods
244+
should be considered for eviction. The default behavior when no policy is specified corresponds
251245
to the `IfHealthyBudget` policy.
252246

253247
Policies:
@@ -287,6 +281,6 @@ You can use a PDB with pods controlled by another type of controller, by an
287281
- only an integer value can be used with `.spec.minAvailable`, not a percentage.
288282

289283
You can use a selector which selects a subset or superset of the pods belonging to a built-in
290-
controller. The eviction API will disallow eviction of any pod covered by multiple PDBs,
291-
so most users will want to avoid overlapping selectors. One reasonable use of overlapping
284+
controller. The eviction API will disallow eviction of any pod covered by multiple PDBs,
285+
so most users will want to avoid overlapping selectors. One reasonable use of overlapping
292286
PDBs is when pods are being transitioned from one PDB to another.

content/en/docs/tasks/run-application/delete-stateful-set.md

+1-13
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@ weight: 60
1414

1515
This task shows you how to delete a {{< glossary_tooltip term_id="StatefulSet" >}}.
1616

17-
18-
1917
## {{% heading "prerequisites" %}}
2018

21-
22-
* This task assumes you have an application running on your cluster represented by a StatefulSet.
23-
24-
19+
- This task assumes you have an application running on your cluster represented by a StatefulSet.
2520

2621
<!-- steps -->
2722

@@ -82,13 +77,6 @@ In the example above, the Pods have the label `app.kubernetes.io/name=MyApp`; su
8277

8378
If you find that some pods in your StatefulSet are stuck in the 'Terminating' or 'Unknown' states for an extended period of time, you may need to manually intervene to forcefully delete the pods from the apiserver. This is a potentially dangerous task. Refer to [Force Delete StatefulSet Pods](/docs/tasks/run-application/force-delete-stateful-set-pod/) for details.
8479

85-
86-
8780
## {{% heading "whatsnext" %}}
8881

89-
9082
Learn more about [force deleting StatefulSet Pods](/docs/tasks/run-application/force-delete-stateful-set-pod/).
91-
92-
93-
94-

0 commit comments

Comments
 (0)