Merge pull request #6815 from tengqm/object-management

Move "Object management using kubectl"
This commit is contained in:
Jennifer Rondeau
2018-01-19 09:06:12 -05:00
committed by GitHub
17 changed files with 63 additions and 55 deletions
@@ -20,7 +20,7 @@ The `kubectl` tool supports three kinds of object management:
* Imperative object configuration
* Declarative object configuration
See [Kubernetes Object Management](/docs/tutorials/object-management-kubectl/object-management/)
See [Kubernetes Object Management](/docs/concepts/overview/object-management-kubectl/overview/)
for a discussion of the advantages and disadvantage of each kind of object management.
## Before you begin
@@ -29,8 +29,8 @@ Declarative object configuration requires a firm understanding of
the Kubernetes object definitions and configuration. Read and complete
the following documents if you have not already:
- [Managing Kubernetes Objects Using Imperative Commands](/docs/tutorials/object-management-kubectl/imperative-object-management-command/)
- [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
- [Managing Kubernetes Objects Using Imperative Commands](/docs/concepts/overview/object-management-kubectl/imperative-command/)
- [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/concepts/overview/object-management-kubectl/imperative-config/)
Following are definitions for terms used in this document:
@@ -61,18 +61,18 @@ configuration file that was used to create the object.
Here's an example of an object configuration file:
{% include code.html language="yaml" file="simple_deployment.yaml" ghlink="/docs/tutorials/object-management-kubectl/simple_deployment.yaml" %}
{% include code.html language="yaml" file="simple_deployment.yaml" ghlink="/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml" %}
Create the object using `kubectl apply`:
```shell
kubectl apply -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml
kubectl apply -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml
```
Print the live configuration using `kubectl get`:
```shell
kubectl get -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml -o yaml
kubectl get -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml -o yaml
```
The output shows that the `kubectl.kubernetes.io/last-applied-configuration` annotation
@@ -129,12 +129,12 @@ kubectl apply -f <directory>/
Here's an example configuration file:
{% include code.html language="yaml" file="simple_deployment.yaml" ghlink="/docs/tutorials/object-management-kubectl/simple_deployment.yaml" %}
{% include code.html language="yaml" file="simple_deployment.yaml" ghlink="/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml" %}
Create the object using `kubectl apply`:
```shell
kubectl apply -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml
kubectl apply -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml
```
**Note:** For purposes of illustration, the preceding command refers to a single
@@ -143,7 +143,7 @@ configuration file instead of a directory.
Print the live configuration using `kubectl get`:
```shell
kubectl get -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml -o yaml
kubectl get -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml -o yaml
```
The output shows that the `kubectl.kubernetes.io/last-applied-configuration` annotation
@@ -194,7 +194,7 @@ kubectl scale deployment/nginx-deployment --replicas=2
Print the live configuration using `kubectl get`:
```shell
kubectl get -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml -o yaml
kubectl get -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml -o yaml
```
The output shows that the `replicas` field has been set to 2, and the `last-applied-configuration`
@@ -237,18 +237,18 @@ spec:
Update the `simple_deployment.yaml` configuration file to change the image from
`nginx:1.7.9` to `nginx:1.11.9`, and delete the `minReadySeconds` field:
{% include code.html language="yaml" file="update_deployment.yaml" ghlink="/docs/tutorials/object-management-kubectl/update_deployment.yaml" %}
{% include code.html language="yaml" file="update_deployment.yaml" ghlink="/docs/concepts/overview/object-management-kubectl/update_deployment.yaml" %}
Apply the changes made to the configuration file:
```shell
kubectl apply -f https://k8s.io/docs/tutorials/object-management-kubectl/update_deployment.yaml
kubectl apply -f https://k8s.io/docs/concepts/overview/object-management-kubectl/update_deployment.yaml
```
Print the live configuration using `kubectl get`:
```
kubectl get -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml -o yaml
kubectl get -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml -o yaml
```
The output shows the following changes to the live configuration:
@@ -383,7 +383,7 @@ to calculate which fields should be deleted or set:
Here's an example. Suppose this is the configuration file for a Deployment object:
{% include code.html language="yaml" file="update_deployment.yaml" ghlink="/docs/tutorials/object-management-kubectl/update_deployment.yaml" %}
{% include code.html language="yaml" file="update_deployment.yaml" ghlink="/docs/concepts/overview/object-management-kubectl/update_deployment.yaml" %}
Also, suppose this is the live configuration for the same Deployment object:
@@ -668,18 +668,18 @@ not specified when the object is created.
Here's a configuration file for a Deployment. The file does not specify `strategy` or `selector`:
{% include code.html language="yaml" file="simple_deployment.yaml" ghlink="/docs/tutorials/object-management-kubectl/simple_deployment.yaml" %}
{% include code.html language="yaml" file="simple_deployment.yaml" ghlink="/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml" %}
Create the object using `kubectl apply`:
```shell
kubectl apply -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml
kubectl apply -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml
```
Print the live configuration using `kubectl get`:
```shell
kubectl get -f https://k8s.io/docs/tutorials/object-management-kubectl/simple_deployment.yaml -o yaml
kubectl get -f https://k8s.io/docs/concepts/overview/object-management-kubectl/simple_deployment.yaml -o yaml
```
The output shows that the API server set several fields to default values in the live
@@ -942,12 +942,12 @@ template:
* Prior to Kubernetes 1.6, `kubectl apply` did not support operating on objects stored in a
[custom resource](/docs/concepts/api-extension/custom-resources/).
For these cluster versions, you should instead use [imperative object configuration](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/).
For these cluster versions, you should instead use [imperative object configuration](/docs/concepts/overview/object-management-kubectl/imperative-config/).
{% endcapture %}
{% capture whatsnext %}
- [Managing Kubernetes Objects Using Imperative Commands](/docs/tutorials/object-management-kubectl/imperative-object-management-command/)
- [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
- [Managing Kubernetes Objects Using Imperative Commands](/docs/concepts/overview/object-management-kubectl/imperative-command/)
- [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/concepts/overview/object-management-kubectl/imperative-config/)
- [Kubectl Command Reference](/docs/user-guide/kubectl/{{page.version}}/)
- [Kubernetes API Reference](/docs/api-reference/{{page.version}}/)
{% endcapture %}
@@ -18,7 +18,7 @@ The `kubectl` tool supports three kinds of object management:
* Imperative object configuration
* Declarative object configuration
See [Kubernetes Object Management](/docs/concepts/tools/kubectl/object-management-overview/)
See [Kubernetes Object Management](/docs/concepts/overview/object-management-kubectl/overview/)
for a discussion of the advantages and disadvantage of each kind of object management.
## How to create objects
@@ -150,8 +150,8 @@ kubectl create --edit -f /tmp/srv.yaml
{% endcapture %}
{% capture whatsnext %}
- [Managing Kubernetes Objects Using Object Configuration (Imperative)](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/)
- [Managing Kubernetes Objects Using Object Configuration (Imperative)](/docs/concepts/overview/object-management-kubectl/imperative-config/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/concepts/overview/object-management-kubectl/declarative-config/)
- [Kubectl Command Reference](/docs/user-guide/kubectl/{{page.version}}/)
- [Kubernetes API Reference](/docs/api-reference/{{page.version}}/)
{% endcapture %}
@@ -18,7 +18,7 @@ The `kubectl` tool supports three kinds of object management:
* Imperative object configuration
* Declarative object configuration
See [Kubernetes Object Management](/docs/tutorials/object-management-kubectl/object-management/)
See [Kubernetes Object Management](/docs/concepts/overview/object-management-kubectl/overview/)
for a discussion of the advantages and disadvantage of each kind of object management.
## How to create objects
@@ -128,8 +128,8 @@ template:
{% endcapture %}
{% capture whatsnext %}
- [Managing Kubernetes Objects Using Imperative Commands](/docs/tutorials/object-management-kubectl/imperative-object-management-command/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/)
- [Managing Kubernetes Objects Using Imperative Commands](/docs/concepts/overview/object-management-kubectl/imperative-command/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/concepts/overview/object-management-kubectl/declarative-config/)
- [Kubectl Command Reference](/docs/user-guide/kubectl/{{page.version}}/)
- [Kubernetes API Reference](/docs/api-reference/{{page.version}}/)
{% endcapture %}
@@ -164,9 +164,9 @@ Disadvantages compared to imperative object configuration:
{% endcapture %}
{% capture whatsnext %}
- [Managing Kubernetes Objects Using Imperative Commands](/docs/tutorials/object-management-kubectl/imperative-object-management-command/)
- [Managing Kubernetes Objects Using Object Configuration (Imperative)](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/)
- [Managing Kubernetes Objects Using Imperative Commands](/docs/concepts/overview/object-management-kubectl/imperative-command/)
- [Managing Kubernetes Objects Using Object Configuration (Imperative)](/docs/concepts/overview/object-management-kubectl/imperative-config/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/concepts/overview/object-management-kubectl/declarative-config/)
- [Kubectl Command Reference](/docs/user-guide/kubectl/{{page.version}}/)
- [Kubernetes API Reference](/docs/api-reference/{{page.version}}/)
@@ -68,7 +68,11 @@ spec:
*POSTing this to the API server will have no effect unless your chosen networking solution supports network policy.*
__Mandatory Fields__: As with all other Kubernetes config, a `NetworkPolicy` needs `apiVersion`, `kind`, and `metadata` fields. For general information about working with config files, see [Configure Containers Using a ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/), and [Object Management](https://kubernetes.io/docs/tutorials/object-management-kubectl/object-management/).
__Mandatory Fields__: As with all other Kubernetes config, a `NetworkPolicy`
needs `apiVersion`, `kind`, and `metadata` fields. For general information
about working with config files, see
[Configure Containers Using a ConfigMap](/docs/tasks/configure-pod-container/configure-pod-configmap/),
and [Object Management](/docs/concepts/overview/object-management-kubectl/overview/).
__spec__: `NetworkPolicy` [spec](https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status) has all the information needed to define a particular network policy in the given namespace.
@@ -45,7 +45,7 @@ kubectl create -f daemonset.yaml
As with all other Kubernetes config, a DaemonSet needs `apiVersion`, `kind`, and `metadata` fields. For
general information about working with config files, see [deploying applications](/docs/user-guide/deploying-applications/),
[configuring containers](/docs/tasks/), and [working with resources](/docs/concepts/tools/kubectl/object-management-overview/) documents.
[configuring containers](/docs/tasks/), and [object management using kubectl](/docs/concepts/overview/object-management-kubectl/overview/) documents.
A DaemonSet also needs a [`.spec`](https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status) section.
@@ -834,7 +834,7 @@ can create multiple Deployments, one for each release, following the canary patt
As with all other Kubernetes configs, a Deployment needs `apiVersion`, `kind`, and `metadata` fields.
For general information about working with config files, see [deploying applications](/docs/tutorials/stateless-application/run-stateless-application-deployment/),
configuring containers, and [using kubectl to manage resources](/docs/tutorials/object-management-kubectl/object-management/) documents.
configuring containers, and [using kubectl to manage resources](/docs/concepts/overview/object-management-kubectl/overview/) documents.
A Deployment also needs a [`.spec` section](https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status).
@@ -96,7 +96,7 @@ frontend-qhloh 1/1 Running 0 1m
## Writing a ReplicaSet Spec
As with all other Kubernetes API objects, a ReplicaSet needs the `apiVersion`, `kind`, and `metadata` fields. For
general information about working with manifests, see [Object Management](/docs/concepts/tools/kubectl/object-management-overview/).
general information about working with manifests, see [object management using kubectl](/docs/concepts/overview/object-management-kubectl/overview/).
A ReplicaSet also needs a [`.spec` section](https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status).
@@ -100,7 +100,7 @@ specifies an expression that just gets the name from each pod in the returned li
## Writing a ReplicationController Spec
As with all other Kubernetes config, a ReplicationController needs `apiVersion`, `kind`, and `metadata` fields.
For general information about working with config files, see [Object Management](/docs/concepts/tools/kubectl/object-management-overview/).
For general information about working with config files, see [object management ](/docs/concepts/overview/object-management-kubectl/overview/).
A ReplicationController also needs a [`.spec` section](https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status).
@@ -104,7 +104,7 @@ update. This can be done with several different `kubectl` commands.
#### Declarative commands
If you update DaemonSets using
[configuration files](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/),
[configuration files](/docs/concepts/overview/object-management-kubectl/declarative-config/),
use `kubectl apply`:
```shell
@@ -114,7 +114,7 @@ kubectl apply -f ds-v2.yaml
#### Imperative commands
If you update DaemonSets using
[imperative commands](/docs/tutorials/object-management-kubectl/imperative-object-management-command/),
[imperative commands](/docs/concepts/overview/object-management-kubectl/imperative-command/),
use `kubectl edit` or `kubectl patch`:
```shell
@@ -261,10 +261,10 @@ and
{% capture whatsnext %}
* [Kubernetes Object Management](/docs/tutorials/object-management-kubectl/object-management/)
* [Managing Kubernetes Objects Using Imperative Commands](/docs/tutorials/object-management-kubectl/imperative-object-management-command/)
* [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/tutorials/object-management-kubectl/imperative-object-management-configuration/)
* [Declarative Management of Kubernetes Objects Using Configuration Files](/docs/tutorials/object-management-kubectl/declarative-object-management-configuration/)
* [Kubernetes Object Management](/docs/concepts/overview/object-management-kubectl/overview/)
* [Managing Kubernetes Objects Using Imperative Commands](/docs/concepts/overview/object-management-kubectl/imperative-command/)
* [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/concepts/overview/object-management-kubectl/imperative-config/)
* [Declarative Management of Kubernetes Objects Using Configuration Files](/docs/concepts/overview/object-management-kubectl/declarative-config/)
{% endcapture %}