Tweak Objects In Kubernetes concept
Co-authored-by: Ader Fu <ader.ydfu@gmail.com>pull/42117/head
parent
6f0c807e69
commit
819d4c32d4
|
@ -33,7 +33,7 @@ will constantly work to ensure that object exists. By creating an object, you're
|
||||||
telling the Kubernetes system what you want your cluster's workload to look like; this is your
|
telling the Kubernetes system what you want your cluster's workload to look like; this is your
|
||||||
cluster's *desired state*.
|
cluster's *desired state*.
|
||||||
|
|
||||||
To work with Kubernetes objects--whether to create, modify, or delete them--you'll need to use the
|
To work with Kubernetes objects—whether to create, modify, or delete them—you'll need to use the
|
||||||
[Kubernetes API](/docs/concepts/overview/kubernetes-api/). When you use the `kubectl` command-line
|
[Kubernetes API](/docs/concepts/overview/kubernetes-api/). When you use the `kubectl` command-line
|
||||||
interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use
|
interface, for example, the CLI makes the necessary Kubernetes API calls for you. You can also use
|
||||||
the Kubernetes API directly in your own programs using one of the
|
the Kubernetes API directly in your own programs using one of the
|
||||||
|
@ -71,15 +71,18 @@ For more information on the object spec, status, and metadata, see the
|
||||||
When you create an object in Kubernetes, you must provide the object spec that describes its
|
When you create an object in Kubernetes, you must provide the object spec that describes its
|
||||||
desired state, as well as some basic information about the object (such as a name). When you use
|
desired state, as well as some basic information about the object (such as a name). When you use
|
||||||
the Kubernetes API to create the object (either directly or via `kubectl`), that API request must
|
the Kubernetes API to create the object (either directly or via `kubectl`), that API request must
|
||||||
include that information as JSON in the request body. **Most often, you provide the information to
|
include that information as JSON in the request body.
|
||||||
`kubectl` in a .yaml file.** `kubectl` converts the information to JSON when making the API
|
Most often, you provide the information to `kubectl` in file known as a _manifest_.
|
||||||
request.
|
By convention, manifests are YAML (you could also use JSON format).
|
||||||
|
Tools such as `kubectl` convert the information from a manifest into JSON or another supported
|
||||||
|
serialization format when making the API request over HTTP.
|
||||||
|
|
||||||
Here's an example `.yaml` file that shows the required fields and object spec for a Kubernetes Deployment:
|
Here's an example manifest that shows the required fields and object spec for a Kubernetes
|
||||||
|
Deployment:
|
||||||
|
|
||||||
{{% code_sample file="application/deployment.yaml" %}}
|
{{% code_sample file="application/deployment.yaml" %}}
|
||||||
|
|
||||||
One way to create a Deployment using a `.yaml` file like the one above is to use the
|
One way to create a Deployment using a manifest file like the one above is to use the
|
||||||
[`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands#apply) command
|
[`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands#apply) command
|
||||||
in the `kubectl` command-line interface, passing the `.yaml` file as an argument. Here's an example:
|
in the `kubectl` command-line interface, passing the `.yaml` file as an argument. Here's an example:
|
||||||
|
|
||||||
|
@ -95,7 +98,8 @@ deployment.apps/nginx-deployment created
|
||||||
|
|
||||||
### Required fields
|
### Required fields
|
||||||
|
|
||||||
In the `.yaml` file for the Kubernetes object you want to create, you'll need to set values for the following fields:
|
In the manifest (YAML or JSON file) for the Kubernetes object you want to create, you'll need to set values for
|
||||||
|
the following fields:
|
||||||
|
|
||||||
* `apiVersion` - Which version of the Kubernetes API you're using to create this object
|
* `apiVersion` - Which version of the Kubernetes API you're using to create this object
|
||||||
* `kind` - What kind of object you want to create
|
* `kind` - What kind of object you want to create
|
||||||
|
@ -159,6 +163,10 @@ If you're new to Kubernetes, read more about the following:
|
||||||
* [Controllers](/docs/concepts/architecture/controller/) in Kubernetes.
|
* [Controllers](/docs/concepts/architecture/controller/) in Kubernetes.
|
||||||
* [kubectl](/docs/reference/kubectl/) and [kubectl commands](/docs/reference/generated/kubectl/kubectl-commands).
|
* [kubectl](/docs/reference/kubectl/) and [kubectl commands](/docs/reference/generated/kubectl/kubectl-commands).
|
||||||
|
|
||||||
|
[Kubernetes Object Management](/docs/concepts/overview/working-with-objects/object-management/)
|
||||||
|
explains how to use `kubectl` to manage objects.
|
||||||
|
You might need to [install kubectl](/docs/tasks/tools/#kubectl) if you don't already have it available.
|
||||||
|
|
||||||
To learn about the Kubernetes API in general, visit:
|
To learn about the Kubernetes API in general, visit:
|
||||||
|
|
||||||
* [Kubernetes API overview](/docs/reference/using-api/)
|
* [Kubernetes API overview](/docs/reference/using-api/)
|
||||||
|
|
Loading…
Reference in New Issue