Skip to content

Commit c185ebb

Browse files
authored
Merge pull request #37593 from sftim/20221029_improve_workload_apis_overview
Improve overview for workload APIs
2 parents 30c99ee + ad54bfe commit c185ebb

File tree

9 files changed

+113
-28
lines changed

9 files changed

+113
-28
lines changed

content/en/docs/concepts/workloads/_index.md

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,68 @@ no_list: true
99
{{< glossary_definition term_id="workload" length="short" >}}
1010
Whether your workload is a single component or several that work together, on Kubernetes you run
1111
it inside a set of [_pods_](/docs/concepts/workloads/pods).
12-
In Kubernetes, a `Pod` represents a set of running
12+
In Kubernetes, a Pod represents a set of running
1313
{{< glossary_tooltip text="containers" term_id="container" >}} on your cluster.
1414

1515
Kubernetes pods have a [defined lifecycle](/docs/concepts/workloads/pods/pod-lifecycle/).
1616
For example, once a pod is running in your cluster then a critical fault on the
1717
{{< glossary_tooltip text="node" term_id="node" >}} where that pod is running means that
1818
all the pods on that node fail. Kubernetes treats that level of failure as final: you
19-
would need to create a new `Pod` to recover, even if the node later becomes healthy.
19+
would need to create a new Pod to recover, even if the node later becomes healthy.
2020

21-
However, to make life considerably easier, you don't need to manage each `Pod` directly.
21+
However, to make life considerably easier, you don't need to manage each Pod directly.
2222
Instead, you can use _workload resources_ that manage a set of pods on your behalf.
2323
These resources configure {{< glossary_tooltip term_id="controller" text="controllers" >}}
2424
that make sure the right number of the right kind of pod are running, to match the state
2525
you specified.
2626

2727
Kubernetes provides several built-in workload resources:
2828

29-
* [`Deployment`](/docs/concepts/workloads/controllers/deployment/) and [`ReplicaSet`](/docs/concepts/workloads/controllers/replicaset/)
29+
* [Deployment](/docs/concepts/workloads/controllers/deployment/) and [ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)
3030
(replacing the legacy resource
3131
{{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}}).
32-
`Deployment` is a good fit for managing a stateless application workload on your cluster,
33-
where any `Pod` in the `Deployment` is interchangeable and can be replaced if needed.
34-
* [`StatefulSet`](/docs/concepts/workloads/controllers/statefulset/) lets you
32+
Deployment is a good fit for managing a stateless application workload on your cluster,
33+
where any Pod in the Deployment is interchangeable and can be replaced if needed.
34+
* [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) lets you
3535
run one or more related Pods that do track state somehow. For example, if your workload
36-
records data persistently, you can run a `StatefulSet` that matches each `Pod` with a
37-
[`PersistentVolume`](/docs/concepts/storage/persistent-volumes/). Your code, running in the
38-
`Pods` for that `StatefulSet`, can replicate data to other `Pods` in the same `StatefulSet`
36+
records data persistently, you can run a StatefulSet that matches each Pod with a
37+
[PersistentVolume](/docs/concepts/storage/persistent-volumes/). Your code, running in the
38+
Pods for that StatefulSet, can replicate data to other Pods in the same StatefulSet
3939
to improve overall resilience.
40-
* [`DaemonSet`](/docs/concepts/workloads/controllers/daemonset/) defines `Pods` that provide
41-
node-local facilities. These might be fundamental to the operation of your cluster, such
42-
as a networking helper tool, or be part of an
43-
{{< glossary_tooltip text="add-on" term_id="addons" >}}.
44-
Every time you add a node to your cluster that matches the specification in a `DaemonSet`,
45-
the control plane schedules a `Pod` for that `DaemonSet` onto the new node.
46-
* [`Job`](/docs/concepts/workloads/controllers/job/) and
47-
[`CronJob`](/docs/concepts/workloads/controllers/cron-jobs/)
48-
define tasks that run to completion and then stop. Jobs represent one-off tasks, whereas
49-
`CronJobs` recur according to a schedule.
40+
* [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) defines Pods that provide
41+
facilities that are local to nodes.
42+
Every time you add a node to your cluster that matches the specification in a DaemonSet,
43+
the control plane schedules a Pod for that DaemonSet onto the new node.
44+
Each pod in a DaemonSet performs a job similar to a system daemon on a classic Unix / POSIX
45+
server. A DaemonSet might be fundamental to the operation of your cluster, such as
46+
a plugin to run [cluster networking](/docs/concepts/cluster-administration/networking/#how-to-implement-the-kubernetes-network-model),
47+
it might help you to manage the node,
48+
or it could provide optional behavior that enhances the container platform you are running.
49+
* [Job](/docs/concepts/workloads/controllers/job/) and
50+
[CronJob](/docs/concepts/workloads/controllers/cron-jobs/) provide different ways to
51+
define tasks that run to completion and then stop.
52+
You can use a [Job](/docs/concepts/workloads/controllers/job/) to
53+
define a task that runs to completion, just once. You can use a
54+
[CronJob](/docs/concepts/workloads/controllers/cron-jobs/) to run
55+
the same Job multiple times according a schedule.
5056

5157
In the wider Kubernetes ecosystem, you can find third-party workload resources that provide
5258
additional behaviors. Using a
5359
[custom resource definition](/docs/concepts/extend-kubernetes/api-extension/custom-resources/),
5460
you can add in a third-party workload resource if you want a specific behavior that's not part
55-
of Kubernetes' core. For example, if you wanted to run a group of `Pods` for your application but
61+
of Kubernetes' core. For example, if you wanted to run a group of Pods for your application but
5662
stop work unless _all_ the Pods are available (perhaps for some high-throughput distributed task),
5763
then you can implement or install an extension that does provide that feature.
5864

5965
## {{% heading "whatsnext" %}}
6066

61-
As well as reading about each resource, you can learn about specific tasks that relate to them:
67+
As well as reading about each API kind for workload management, you can read how to
68+
do specific tasks:
6269

63-
* [Run a stateless application using a `Deployment`](/docs/tasks/run-application/run-stateless-application-deployment/)
70+
* [Run a stateless application using a Deployment](/docs/tasks/run-application/run-stateless-application-deployment/)
6471
* Run a stateful application either as a [single instance](/docs/tasks/run-application/run-single-instance-stateful-application/)
6572
or as a [replicated set](/docs/tasks/run-application/run-replicated-stateful-application/)
66-
* [Run automated tasks with a `CronJob`](/docs/tasks/job/automated-tasks-with-cron-jobs/)
73+
* [Run automated tasks with a CronJob](/docs/tasks/job/automated-tasks-with-cron-jobs/)
6774

6875
To learn about Kubernetes' mechanisms for separating code from configuration,
6976
visit [Configuration](/docs/concepts/configuration/).
@@ -76,6 +83,6 @@ for applications:
7683
removes Jobs once a defined time has passed since they completed.
7784

7885
Once your application is running, you might want to make it available on the internet as
79-
a [`Service`](/docs/concepts/services-networking/service/) or, for web application only,
80-
using an [`Ingress`](/docs/concepts/services-networking/ingress).
86+
a [Service](/docs/concepts/services-networking/service/) or, for web application only,
87+
using an [Ingress](/docs/concepts/services-networking/ingress).
8188

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,61 @@
11
---
22
title: "Workload Resources"
33
weight: 20
4+
simple_list: true
45
---
56

7+
Kubernetes provides several built-in APIs for declarative management of your
8+
{{< glossary_tooltip text="workloads" term_id="workload" >}}
9+
and the components of those workloads.
10+
11+
Ultimately, your applications run as containers inside
12+
{{< glossary_tooltip term_id="Pod" text="Pods" >}}; however, managing individual
13+
Pods would be a lot of effort. For example, if a Pod fails, you probably want to
14+
run a new Pod to replace it. Kubernetes can do that for you.
15+
16+
You use the Kubernetes API to create workload
17+
{{< glossary_tooltip text="object" term_id="object" >}} that represent a higher level
18+
abstraction than a Pod, and then the Kubernetes
19+
{{< glossary_tooltip text="control plane" term_id="control-plane" >}} automatically manages
20+
Pod objects on your behalf, based on the specification for the workload object you defined.
21+
22+
The built-in APIs for managing workloads are:
23+
24+
[Deployment](/docs/concepts/workloads/controllers/deployment/) (and, indirectly, [ReplicaSet](/docs/concepts/workloads/controllers/replicaset/)),
25+
the most common way to run an application on your cluster.
26+
Deployment is a good fit for managing a stateless application workload on your cluster, where
27+
any Pod in the Deployment is interchangeable and can be replaced if needed.
28+
(Deployments are a replacement for the legacy
29+
{{< glossary_tooltip text="ReplicationController" term_id="replication-controller" >}} API).
30+
31+
A [StatefulSet](/docs/concepts/workloads/controllers/statefulset/) lets you
32+
manage one or more Pods – all running the same application code – where the Pods rely
33+
on having a distinct identity. This is different from a Deployment where the Pods are
34+
expected to be interchangeable.
35+
The most common use for a StatefulSet is to be able to make a link between its Pods and
36+
their persistent storage. For example, you can run a StatefulSet that associates each Pod
37+
with a [PersistentVolume](/docs/concepts/storage/persistent-volumes/). If one of the Pods
38+
in the StatefulSet fails, Kubernetes makes a replacement Pod that is connected to the
39+
same PersistentVolume.
40+
41+
A [DaemonSet](/docs/concepts/workloads/controllers/daemonset/) defines Pods that provide
42+
facilities that are local to a specific {{< glossary_tooltip text="node" term_id="node" >}};
43+
for example, a driver that lets containers on that node access a storage system. You use a DaemonSet
44+
when the driver, or other node-level service, has to run on the node where it's useful.
45+
Each Pod in a DaemonSet performs a role similar to a system daemon on a classic Unix / POSIX
46+
server.
47+
A DaemonSet might be fundamental to the operation of your cluster,
48+
such as a plugin to let that node access
49+
[cluster networking](/docs/concepts/cluster-administration/networking/#how-to-implement-the-kubernetes-network-model),
50+
it might help you to manage the node,
51+
or it could provide less essential facilities that enhance the container platform you are running.
52+
You can run DaemonSets (and their pods) across every node in your cluster, or across just a subset (for example,
53+
only install the GPU accelerator driver on nodes that have a GPU installed).
54+
55+
You can use a [Job](/docs/concepts/workloads/controllers/job/) and / or
56+
a [CronJob](/docs/concepts/workloads/controllers/cron-jobs/) to
57+
define tasks that run to completion and then stop. A Job represents a one-off task,
58+
whereas each CronJob repeats according to a schedule.
59+
60+
Other topics in this section:
61+
<!-- relies on simple_list: true in the front matter -->

content/en/docs/concepts/workloads/controllers/cron-jobs.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ reviewers:
55
- janetkuo
66
title: CronJob
77
content_type: concept
8+
description: >-
9+
A CronJob starts one-time Jobs on a repeating schedule.
810
weight: 80
11+
hide_summary: true # Listed separately in section index
912
---
1013

1114
<!-- overview -->

content/en/docs/concepts/workloads/controllers/daemonset.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ reviewers:
66
- janetkuo
77
- kow3ns
88
title: DaemonSet
9+
description: >-
10+
A DaemonSet defines Pods that provide node-local facilities. These might be fundamental to the operation of your cluster, such as a networking helper tool, or be part of an add-on.
911
content_type: concept
1012
weight: 40
13+
hide_summary: true # Listed separately in section index
1114
---
1215

1316
<!-- overview -->

content/en/docs/concepts/workloads/controllers/deployment.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ feature:
66
title: Automated rollouts and rollbacks
77
description: >
88
Kubernetes progressively rolls out changes to your application or its configuration, while monitoring application health to ensure it doesn't kill all your instances at the same time. If something goes wrong, Kubernetes will rollback the change for you. Take advantage of a growing ecosystem of deployment solutions.
9-
9+
description: >-
10+
A Deployment manages a set of Pods to run an application workload, usually one that doesn't maintain state.
1011
content_type: concept
1112
weight: 10
13+
hide_summary: true # Listed separately in section index
1214
---
1315

1416
<!-- overview -->

content/en/docs/concepts/workloads/controllers/job.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ reviewers:
55
- soltysh
66
title: Jobs
77
content_type: concept
8+
description: >-
9+
Jobs represent one-off tasks that run to completion and then stop.
810
feature:
911
title: Batch execution
1012
description: >
1113
In addition to services, Kubernetes can manage your batch and CI workloads, replacing containers that fail, if desired.
1214
weight: 50
15+
hide_summary: true # Listed separately in section index
1316
---
1417

1518
<!-- overview -->

content/en/docs/concepts/workloads/controllers/replicaset.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ feature:
1212
kills containers that don't respond to your user-defined health check,
1313
and doesn't advertise them to clients until they are ready to serve.
1414
content_type: concept
15+
description: >-
16+
A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time.
17+
Usually, you define a Deployment and let that Deployment manage ReplicaSets automatically.
1518
weight: 20
19+
hide_summary: true # Listed separately in section index
1620
---
1721

1822
<!-- overview -->

content/en/docs/concepts/workloads/controllers/replicationcontroller.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ reviewers:
55
title: ReplicationController
66
content_type: concept
77
weight: 90
8+
description: >-
9+
Legacy API for managing workloads that can scale horizontally.
10+
Superseded by the Deployment and ReplicaSet APIs.
811
---
912

1013
<!-- overview -->
@@ -19,7 +22,7 @@ always up and available.
1922

2023
<!-- body -->
2124

22-
## How a ReplicationController Works
25+
## How a ReplicationController works
2326

2427
If there are too many pods, the ReplicationController terminates the extra pods. If there are too few, the
2528
ReplicationController starts more pods. Unlike manually created pods, the pods maintained by a

content/en/docs/concepts/workloads/controllers/statefulset.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ reviewers:
88
- smarterclayton
99
title: StatefulSets
1010
content_type: concept
11+
description: >-
12+
A StatefulSet runs a group of Pods, and maintains a sticky identity for each of those Pods. This is useful for managing
13+
applications that need persistent storage or a stable, unique network identity.
1114
weight: 30
15+
hide_summary: true # Listed separately in section index
1216
---
1317

1418
<!-- overview -->

0 commit comments

Comments
 (0)