Skip to content

Commit

Permalink
move obj mgmt files to tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
kbhawkey committed May 16, 2019
1 parent 21b7d12 commit 4684a62
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 74 deletions.
3 changes: 1 addition & 2 deletions content/en/docs/concepts/overview/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
title: "Overview"
weight: 20
---

---

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Kubernetes Object Management
content_template: templates/concept
weight: 10
weight: 15
---

{{% capture overview %}}
Expand Down Expand Up @@ -176,13 +176,13 @@ Disadvantages compared to imperative object configuration:
{{% /capture %}}

{{% capture whatsnext %}}
- [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/)

- [Managing Kubernetes Objects Using Imperative Commands](/docs/tasks/manage-kubernetes-objects/imperative-command/)
- [Managing Kubernetes Objects Using Object Configuration (Imperative)](/docs/tasks/manage-kubernetes-objects/imperative-config/)
- [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/tasks/manage-kubernetes-objects/declarative-config/)
- [Managing Kubernetes Objects Using Kustomize (Declarative)](/docs/tasks/manage-kubernetes-objects/kustomization/)
- [Kubectl Command Reference](/docs/reference/generated/kubectl/kubectl-commands/)
- [Kubectl Book](https://kubectl.docs.kubernetes.io)
- [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)

{{< comment >}}
{{< /comment >}}
{{% /capture %}}
4 changes: 4 additions & 0 deletions content/en/docs/tasks/manage-kubernetes-objects/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Manage Kubernetes Objects"
weight: 25
---
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Declarative Management of Kubernetes Objects Using Configuration Files
content_template: templates/concept
weight: 40
content_template: templates/task
weight: 10
---

{{% capture overview %}}
Expand All @@ -13,7 +13,15 @@ back into the object configuration files. `kubectl diff` also gives you a
preview of what changes `apply` will make.
{{% /capture %}}

{{% capture body %}}
{{% capture prerequisites %}}

Install [`kubectl`](docs/tasks/tools/install-kubectl/).

{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

{{% /capture %}}

{{% capture steps %}}

## Trade-offs

Expand All @@ -26,14 +34,14 @@ The `kubectl` tool supports three kinds of 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
## Overview

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/concepts/overview/object-management-kubectl/imperative-command/)
- [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/concepts/overview/object-management-kubectl/imperative-config/)
* [Managing Kubernetes Objects Using Imperative Commands](/docs/tasks/manage-kubernetes-objects/imperative-command/)
* [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/tasks/manage-kubernetes-objects/imperative-config/)

Following are definitions for terms used in this document:

Expand Down Expand Up @@ -69,9 +77,11 @@ Here's an example of an object configuration file:
{{< codenew file="application/simple_deployment.yaml" >}}

Run `kubectl diff` to print the object that will be created:

```shell
kubectl diff -f https://k8s.io/examples/application/simple_deployment.yaml
```

{{< note >}}
`diff` uses [server-side dry-run](/docs/reference/using-api/api-concepts/#dry-run), which needs to be enabled on `kube-apiserver`.
{{< /note >}}
Expand Down Expand Up @@ -278,18 +288,18 @@ kubectl apply -f https://k8s.io/examples/application/update_deployment.yaml

Print the live configuration using `kubectl get`:

```
```shell
kubectl get -f https://k8s.io/examples/application/simple_deployment.yaml -o yaml
```

The output shows the following changes to the live configuration:

- The `replicas` field retains the value of 2 set by `kubectl scale`.
* The `replicas` field retains the value of 2 set by `kubectl scale`.
This is possible because it is omitted from the configuration file.
- The `image` field has been updated to `nginx:1.11.9` from `nginx:1.7.9`.
- The `last-applied-configuration` annotation has been updated with the new image.
- The `minReadySeconds` field has been cleared.
- The `last-applied-configuration` annotation no longer contains the `minReadySeconds` field.
* The `image` field has been updated to `nginx:1.11.9` from `nginx:1.7.9`.
* The `last-applied-configuration` annotation has been updated with the new image.
* The `minReadySeconds` field has been cleared.
* The `last-applied-configuration` annotation no longer contains the `minReadySeconds` field.

```yaml
apiVersion: apps/v1
Expand Down Expand Up @@ -983,8 +993,10 @@ template:
```

{{% capture whatsnext %}}
- [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/reference/generated/kubectl/kubectl/)
- [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)

* [Managing Kubernetes Objects Using Imperative Commands](/docs/tasks/manage-kubernetes-objects/imperative-command/)
* [Imperative Management of Kubernetes Objects Using Configuration Files](/docs/tasks/manage-kubernetes-objects/imperative-config/)
* [Kubectl Command Reference](/docs/reference/generated/kubectl/kubectl/)
* [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)

{{% /capture %}}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Managing Kubernetes Objects Using Imperative Commands
content_template: templates/concept
weight: 20
content_template: templates/task
weight: 30
---

{{% capture overview %}}
Expand All @@ -10,7 +10,14 @@ imperative commands built into the `kubectl` command-line tool. This document
explains how those commands are organized and how to use them to manage live objects.
{{% /capture %}}

{{% capture body %}}
{{% capture prerequisites %}}
Install [`kubectl`](docs/tasks/tools/install-kubectl/).

{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

{{% /capture %}}

{{% capture steps %}}

## Trade-offs

Expand Down Expand Up @@ -155,8 +162,10 @@ kubectl create --edit -f /tmp/srv.yaml
{{% /capture %}}

{{% capture whatsnext %}}
- [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/reference/generated/kubectl/kubectl/)
- [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)

* [Managing Kubernetes Objects Using Object Configuration (Imperative)](/docs/tasks/manage-kubernetes-objects/imperative-config/)
* [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/tasks/manage-kubernetes-objects/declarative-config/)
* [Kubectl Command Reference](/docs/reference/generated/kubectl/kubectl/)
* [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)

{{% /capture %}}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Imperative Management of Kubernetes Objects Using Configuration Files
content_template: templates/concept
weight: 30
content_template: templates/task
weight: 40
---

{{% capture overview %}}
Expand All @@ -10,7 +10,15 @@ command-line tool along with an object configuration file written in YAML or JSO
This document explains how to define and manage objects using configuration files.
{{% /capture %}}

{{% capture body %}}
{{% capture prerequisites %}}

Install [`kubectl`](docs/tasks/tools/install-kubectl/).

{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}

{{% /capture %}}

{{% capture steps %}}

## Trade-offs

Expand All @@ -29,7 +37,7 @@ You can use `kubectl create -f` to create an object from a configuration file.
Refer to the [kubernetes API reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)
for details.

- `kubectl create -f <filename|url>`
* `kubectl create -f <filename|url>`

## How to update objects

Expand All @@ -46,21 +54,21 @@ file to prevent `replace` from dropping them.
You can use `kubectl replace -f` to update a live object according to a
configuration file.

- `kubectl replace -f <filename|url>`
* `kubectl replace -f <filename|url>`

## How to delete objects

You can use `kubectl delete -f` to delete an object that is described in a
configuration file.

- `kubectl delete -f <filename|url>`
* `kubectl delete -f <filename|url>`

## How to view an object

You can use `kubectl get -f` to view information about an object that is
described in a configuration file.

- `kubectl get -f <filename|url> -o yaml`
* `kubectl get -f <filename|url> -o yaml`

The `-o yaml` flag specifies that the full object configuration is printed.
Use `kubectl get -h` to see a list of options.
Expand Down Expand Up @@ -90,7 +98,7 @@ Suppose you have the URL of an object configuration file. You can use
object is created. This is particularly useful for tutorials and tasks
that point to a configuration file that could be modified by the reader.

```sh
```shell
kubectl create -f <url> --edit
```

Expand All @@ -100,18 +108,19 @@ Migrating from imperative commands to imperative object configuration involves
several manual steps.

1. Export the live object to a local object configuration file:
```sh

```shell
kubectl get <kind>/<name> -o yaml --export > <kind>_<name>.yaml
```

1. Manually remove the status field from the object configuration file.

1. For subsequent object management, use `replace` exclusively.
```sh

```shell
kubectl replace -f <kind>_<name>.yaml
```


## Defining controller selectors and PodTemplate labels

{{< warning >}}
Expand All @@ -136,10 +145,10 @@ template:
{{% /capture %}}
{{% capture whatsnext %}}
- [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/reference/generated/kubectl/kubectl/)
- [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)
{{% /capture %}}
* [Managing Kubernetes Objects Using Imperative Commands](/docs/tasks/manage-kubernetes-objects/imperative-command/)
* [Managing Kubernetes Objects Using Object Configuration (Declarative)](/docs/tasks/manage-kubernetes-objects/declarative-config/)
* [Kubectl Command Reference](/docs/reference/generated/kubectl/kubectl/)
* [Kubernetes API Reference](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/)
{{% /capture %}}
Loading

0 comments on commit 4684a62

Please sign in to comment.