Skip to content

Commit 634c17f

Browse files
Tim Bannisterdivya-mohan0209
Tim Bannister
andcommitted
Reorganize Working with Kubernetes Objects section
- move Understanding Kubernetes Objects to be section overview - within the section, consistently link to the new (moved) page from the first mention of “object” - add a redirect Co-authored-by: Divya Mohan
1 parent cd4cad9 commit 634c17f

File tree

21 files changed

+168
-156
lines changed

21 files changed

+168
-156
lines changed

content/en/docs/concepts/architecture/controller.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ closer to the desired state, by turning equipment on or off.
2626
## Controller pattern
2727

2828
A controller tracks at least one Kubernetes resource type.
29-
These [objects](/docs/concepts/overview/working-with-objects/kubernetes-objects/#kubernetes-objects)
29+
These {{< glossary_tooltip text="objects" term_id="object" >}}
3030
have a spec field that represents the desired state. The
3131
controller(s) for that resource are responsible for making the current
3232
state come closer to that desired state.
@@ -162,7 +162,7 @@ controller does.
162162
## {{% heading "whatsnext" %}}
163163

164164
* Read about the [Kubernetes control plane](/docs/concepts/overview/components/#control-plane-components)
165-
* Discover some of the basic [Kubernetes objects](/docs/concepts/overview/working-with-objects/kubernetes-objects/)
165+
* Discover some of the basic [Kubernetes objects](/docs/concepts/overview/working-with-objects/)
166166
* Learn more about the [Kubernetes API](/docs/concepts/overview/kubernetes-api/)
167167
* If you want to write your own controller, see
168168
[Extension Patterns](/docs/concepts/extend-kubernetes/#extension-patterns)

content/en/docs/concepts/configuration/configmap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ separate database or file service.
3636

3737
## ConfigMap object
3838

39-
A ConfigMap is an API [object](/docs/concepts/overview/working-with-objects/kubernetes-objects/)
39+
A ConfigMap is an {{< glossary_tooltip text="API object" term_id="object" >}}
4040
that lets you store configuration for other objects to use. Unlike most
4141
Kubernetes objects that have a `spec`, a ConfigMap has `data` and `binaryData`
4242
fields. These fields accept key-value pairs as their values. Both the `data`

content/en/docs/concepts/configuration/manage-resources-containers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ see the [Troubleshooting](#troubleshooting) section.
226226
### Monitoring compute & memory resource usage
227227

228228
The kubelet reports the resource usage of a Pod as part of the Pod
229-
[`status`](/docs/concepts/overview/working-with-objects/kubernetes-objects/#object-spec-and-status).
229+
[`status`](/docs/concepts/overview/working-with-objects/#object-spec-and-status).
230230

231231
If optional [tools for monitoring](/docs/tasks/debug/debug-cluster/resource-usage-monitoring/)
232232
are available in your cluster, then Pod resource usage can be retrieved either

content/en/docs/concepts/extend-kubernetes/api-extension/custom-resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ methods for adding custom resources and how to choose between them.
1717
## Custom resources
1818

1919
A *resource* is an endpoint in the [Kubernetes API](/docs/concepts/overview/kubernetes-api/) that
20-
stores a collection of [API objects](/docs/concepts/overview/working-with-objects/kubernetes-objects/)
20+
stores a collection of {{< glossary_tooltip text="API objects" term_id="object" >}}
2121
of a certain kind; for example, the built-in *pods* resource contains a collection of Pod objects.
2222

2323
A *custom resource* is an extension of the Kubernetes API that is not necessarily available in a default
Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,137 @@
11
---
2-
title: "Working with Kubernetes Objects"
3-
weight: 40
2+
title: Understanding Kubernetes Objects
3+
content_type: concept
4+
weight: 10
45
description: >
5-
Kubernetes objects are persistent entities in the Kubernetes system. Kubernetes uses these entities to represent the state of your cluster.
6+
Kubernetes objects are persistent entities in the Kubernetes system.
7+
Kubernetes uses these entities to represent the state of your cluster.
68
Learn about the Kubernetes object model and how to work with these objects.
9+
simple_list: true
10+
card:
11+
name: concepts
12+
weight: 40
713
---
14+
15+
16+
17+
This page explains how Kubernetes objects are represented in the Kubernetes API, and how you can
18+
express them in `.yaml` format.
19+
20+
21+
22+
## Objects in Kubernetes {#kubernetes-objects}
23+
24+
*Kubernetes objects* are persistent entities in the Kubernetes system. Kubernetes uses these
25+
entities to represent the state of your cluster. Specifically, they can describe:
26+
27+
* What containerized applications are running (and on which nodes)
28+
* The resources available to those applications
29+
* The policies around how those applications behave, such as restart policies, upgrades, and fault-tolerance
30+
31+
A Kubernetes object is a "record of intent"--once you create the object, the Kubernetes system
32+
will constantly work to ensure that object exists. By creating an object, you're effectively
33+
telling the Kubernetes system what you want your cluster's workload to look like; this is your
34+
cluster's *desired state*.
35+
36+
To work with Kubernetes objects--whether to create, modify, or delete them--you'll need to use the
37+
[Kubernetes API](/docs/concepts/overview/kubernetes-api/). When you use the `kubectl` command-line
38+
interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use
39+
the Kubernetes API directly in your own programs using one of the
40+
[Client Libraries](/docs/reference/using-api/client-libraries/).
41+
42+
### Object spec and status
43+
44+
Almost every Kubernetes object includes two nested object fields that govern
45+
the object's configuration: the object *`spec`* and the object *`status`*.
46+
For objects that have a `spec`, you have to set this when you create the object,
47+
providing a description of the characteristics you want the resource to have:
48+
its _desired state_.
49+
50+
The `status` describes the _current state_ of the object, supplied and updated
51+
by the Kubernetes system and its components. The Kubernetes
52+
{{< glossary_tooltip text="control plane" term_id="control-plane" >}} continually
53+
and actively manages every object's actual state to match the desired state you
54+
supplied.
55+
56+
For example: in Kubernetes, a Deployment is an object that can represent an
57+
application running on your cluster. When you create the Deployment, you
58+
might set the Deployment `spec` to specify that you want three replicas of
59+
the application to be running. The Kubernetes system reads the Deployment
60+
spec and starts three instances of your desired application--updating
61+
the status to match your spec. If any of those instances should fail
62+
(a status change), the Kubernetes system responds to the difference
63+
between spec and status by making a correction--in this case, starting
64+
a replacement instance.
65+
66+
For more information on the object spec, status, and metadata, see the
67+
[Kubernetes API Conventions](https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md).
68+
69+
### Describing a Kubernetes object
70+
71+
When you create an object in Kubernetes, you must provide the object spec that describes its
72+
desired state, as well as some basic information about the object (such as a name). When you use
73+
the Kubernetes API to create the object (either directly or via `kubectl`), that API request must
74+
include that information as JSON in the request body. **Most often, you provide the information to
75+
`kubectl` in a .yaml file.** `kubectl` converts the information to JSON when making the API
76+
request.
77+
78+
Here's an example `.yaml` file that shows the required fields and object spec for a Kubernetes Deployment:
79+
80+
{{< codenew file="application/deployment.yaml" >}}
81+
82+
One way to create a Deployment using a `.yaml` file like the one above is to use the
83+
[`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands#apply) command
84+
in the `kubectl` command-line interface, passing the `.yaml` file as an argument. Here's an example:
85+
86+
```shell
87+
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
88+
```
89+
90+
The output is similar to this:
91+
92+
```
93+
deployment.apps/nginx-deployment created
94+
```
95+
96+
### Required fields
97+
98+
In the `.yaml` file for the Kubernetes object you want to create, you'll need to set values for the following fields:
99+
100+
* `apiVersion` - Which version of the Kubernetes API you're using to create this object
101+
* `kind` - What kind of object you want to create
102+
* `metadata` - Data that helps uniquely identify the object, including a `name` string, `UID`, and optional `namespace`
103+
* `spec` - What state you desire for the object
104+
105+
The precise format of the object `spec` is different for every Kubernetes object, and contains
106+
nested fields specific to that object. The [Kubernetes API Reference](/docs/reference/kubernetes-api/)
107+
can help you find the spec format for all of the objects you can create using Kubernetes.
108+
109+
For example, see the [`spec` field](/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec)
110+
for the Pod API reference.
111+
For each Pod, the `.spec` field specifies the pod and its desired state (such as the container image name for
112+
each container within that pod).
113+
Another example of an object specification is the
114+
[`spec` field](/docs/reference/kubernetes-api/workload-resources/stateful-set-v1/#StatefulSetSpec)
115+
for the StatefulSet API. For StatefulSet, the `.spec` field specifies the StatefulSet and
116+
its desired state.
117+
Within the `.spec` of a StatefulSet is a [template](/docs/concepts/workloads/pods/#pod-templates)
118+
for Pod objects. That template describes Pods that the StatefulSet controller will create in order to
119+
satisfy the StatefulSet specification.
120+
Different kinds of object can also have different `.status`; again, the API reference pages
121+
detail the structure of that `.status` field, and its content for each different type of object.
122+
123+
## {{% heading "whatsnext" %}}
124+
125+
If you're new to Kubernetes, read more about the following:
126+
127+
* [Pods](/docs/concepts/workloads/pods/) which are the most important basic Kubernetes objects.
128+
* [Deployment](/docs/concepts/workloads/controllers/deployment/) objects.
129+
* [Controllers](/docs/concepts/architecture/controller/) in Kubernetes.
130+
* [kubectl](/docs/reference/kubectl/) and [kubectl commands](/docs/reference/generated/kubectl/kubectl-commands).
131+
132+
To learn about the Kubernetes API in general, visit:
133+
134+
* [Kubernetes API overview](/docs/reference/using-api/)
135+
136+
To learn about objects in Kubernetes in more depth, read other pages in this section:
137+

content/en/docs/concepts/overview/working-with-objects/annotations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ weight: 60
66

77
88
You can use Kubernetes annotations to attach arbitrary non-identifying metadata
9-
to objects. Clients such as tools and libraries can retrieve this metadata.
9+
to {{< glossary_tooltip text="objects" term_id="object" >}}.
10+
Clients such as tools and libraries can retrieve this metadata.
1011

1112
1213
## Attaching metadata to objects

content/en/docs/concepts/overview/working-with-objects/field-selectors.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ content_type: concept
44
weight: 70
55
---
66

7-
_Field selectors_ let you [select Kubernetes resources](/docs/concepts/overview/working-with-objects/kubernetes-objects) based on the value of one or more resource fields. Here are some examples of field selector queries:
7+
_Field selectors_ let you select Kubernetes {{< glossary_tooltip text="objects" term_id="object" >}} based on the
8+
value of one or more resource fields. Here are some examples of field selector queries:
89

910
* `metadata.name=my-service`
1011
* `metadata.namespace!=default`

content/en/docs/concepts/overview/working-with-objects/finalizers.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ weight: 80
88

99
{{}}
1010

11+
You can use finalizers to control {{}}
12+
of {{< glossary_tooltip text="objects" term_id="object" >}} by alerting {{}}
13+
to perform specific cleanup tasks before deleting the target resource.
14+
1115
Finalizers don't usually specify the code to execute. Instead, they are
1216
typically lists of keys on a specific resource similar to annotations.
1317
Kubernetes specifies some finalizers automatically, but you can also specify

content/en/docs/concepts/overview/working-with-objects/kubernetes-objects.md

Lines changed: 0 additions & 126 deletions
This file was deleted.

content/en/docs/concepts/overview/working-with-objects/labels.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ weight: 40
88

99
1010

11-
_Labels_ are key/value pairs that are attached to objects, such as pods.
11+
_Labels_ are key/value pairs that are attached to
12+
{{< glossary_tooltip text="objects" term_id="object" >}} such as Pods.
1213
Labels are intended to be used to specify identifying attributes of objects
1314
that are meaningful and relevant to users, but do not directly imply semantics
1415
to the core system. Labels can be used to organize and to select subsets of

content/en/docs/concepts/overview/working-with-objects/names.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ weight: 30
99

1010
1111

12-
Each object in your cluster has a [_Name_](#names) that is unique for that type of resource.
12+
Each {{< glossary_tooltip text="object" term_id="object" >}} in your cluster has a [_Name_](#names) that is unique for that type of resource.
1313
Every Kubernetes object also has a [_UID_](#uids) that is unique across your whole cluster.
1414

1515
For example, you can only have one Pod named `myapp-1234` within the same [namespace](/docs/concepts/overview/working-with-objects/namespaces/), but you can have one Pod and one Deployment that are each named `myapp-1234`.

content/en/docs/concepts/overview/working-with-objects/namespaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ weight: 45
1010

1111
1212

13-
In Kubernetes, _namespaces_ provides a mechanism for isolating groups of resources within a single cluster. Names of resources need to be unique within a namespace, but not across namespaces. Namespace-based scoping is applicable only for namespaced objects _(e.g. Deployments, Services, etc)_ and not for cluster-wide objects _(e.g. StorageClass, Nodes, PersistentVolumes, etc)_.
13+
In Kubernetes, _namespaces_ provides a mechanism for isolating groups of resources within a single cluster. Names of resources need to be unique within a namespace, but not across namespaces. Namespace-based scoping is applicable only for namespaced {{< glossary_tooltip text="objects" term_id="object" >}} _(e.g. Deployments, Services, etc)_ and not for cluster-wide objects _(e.g. StorageClass, Nodes, PersistentVolumes, etc)_.
1414

1515
1616

content/en/docs/concepts/overview/working-with-objects/object-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ weight: 20
66

77
88
The `kubectl` command-line tool supports several different ways to create and manage
9-
Kubernetes objects. This document provides an overview of the different
9+
Kubernetes {{< glossary_tooltip text="objects" term_id="object" >}}. This document provides an overview of the different
1010
approaches. Read the [Kubectl book](https://kubectl.docs.kubernetes.io) for
1111
details of managing objects by Kubectl.
1212

0 commit comments

Comments
 (0)