You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/cluster-administration/manage-deployment.md
+17-20Lines changed: 17 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,22 +8,19 @@ title: Managing Resources
8
8
9
9
You've deployed your application and exposed it via a service. Now what? Kubernetes provides a number of tools to help you manage your application deployment, including scaling and updating. Among the features that we will discuss in more depth are [configuration files](/docs/concepts/configuration/overview/) and [labels](/docs/concepts/overview/working-with-objects/labels/).
10
10
11
-
You can find all the files for this example [in our docs
Many applications require multiple resources to be created, such as a Deployment and a Service. Management of multiple resources can be simplified by grouping them together in the same file (separated by `---` in YAML). For example:
20
17
21
-
{% include code.html language="yaml" file="nginx-app.yaml" ghlink="/docs/user-guide/nginx-app.yaml" %}
18
+
{% include code.html language="yaml" file="nginx-app.yaml" ghlink="/docs/concepts/cluster-administration/nginx-app.yaml" %}
22
19
23
20
Multiple resources can be created the same way as a single resource:
@@ -58,7 +55,7 @@ deployment "nginx-deployment" created
58
55
Resource creation isn't the only operation that `kubectl` can perform in bulk. It can also extract resource names from configuration files in order to perform other operations, in particular to delete the same resources you created:
@@ -80,12 +77,12 @@ service "my-nginx-svc" deleted
80
77
Because `kubectl` outputs resource names in the same syntax it accepts, it's easy to chain operations using `$()` or `xargs`:
81
78
82
79
```shell
83
-
$ kubectl get $(kubectl create -f docs/user-guide/nginx/ -o name | grep service)
80
+
$ kubectl get $(kubectl create -f docs/concepts/cluster-administration/nginx/ -o name | grep service)
84
81
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
85
82
my-nginx-svc 10.0.0.208 <pending> 80/TCP 0s
86
83
```
87
84
88
-
With the above commands, we first create resources under `docs/user-guide/nginx/` and print the resources created with `-o name` output format
85
+
With the above commands, we first create resources under `docs/concepts/cluster-administration/nginx/` and print the resources created with `-o name` output format
89
86
(print each resource as resource/name). Then we `grep` only the "service", and then print it with `kubectl get`.
90
87
91
88
If you happen to organize your resources across several subdirectories within a particular directory, you can recursively perform the operations on the subdirectories also, by specifying `--recursive` or `-R` alongside the `--filename,-f` flag.
@@ -131,7 +128,7 @@ deployment "my-deployment" created
131
128
persistentvolumeclaim "my-pvc" created
132
129
```
133
130
134
-
If you're interested in learning more about `kubectl`, go ahead and read [kubectl Overview](/docs/user-guide/kubectl-overview).
131
+
If you're interested in learning more about `kubectl`, go ahead and read [kubectl Overview](/docs/reference/kubectl/overview/).
135
132
136
133
## Using labels effectively
137
134
@@ -256,7 +253,7 @@ my-nginx-2035384211-u3t6x 1/1 Running 0 23m fe
256
253
257
254
This outputs all "app=nginx" pods, with an additional label column of pods' tier (specified with `-L` or `--label-columns`).
258
255
259
-
For more information, please see [labels](/docs/concepts/overview/working-with-objects/labels/) and [kubectl label](/docs/user-guide/kubectl/{{page.version}}/#label) document.
256
+
For more information, please see [labels](/docs/concepts/overview/working-with-objects/labels/) and [kubectl label](/docs/reference/generated/kubectl/kubectl-commands/#label).
260
257
261
258
## Updating annotations
262
259
@@ -273,7 +270,7 @@ metadata:
273
270
...
274
271
```
275
272
276
-
For more information, please see [annotations](/docs/concepts/overview/working-with-objects/annotations/) and [kubectl annotate](/docs/user-guide/kubectl/{{page.version}}/#annotate) document.
273
+
For more information, please see [annotations](/docs/concepts/overview/working-with-objects/annotations/) and [kubectl annotate](/docs/reference/generated/kubectl/kubectl-commands/#annotate) document.
Now your nginx replicas will be scaled up and down as needed, automatically.
303
300
304
-
For more information, please see [kubectl scale](/docs/user-guide/kubectl/{{page.version}}/#scale), [kubectl autoscale](/docs/user-guide/kubectl/{{page.version}}/#autoscale) and [horizontal pod autoscaler](/docs/tasks/run-application/horizontal-pod-autoscale/) document.
301
+
For more information, please see [kubectl scale](/docs/reference/generated/kubectl/kubectl-commands/#scale), [kubectl autoscale](/docs/reference/generated/kubectl/kubectl-commands/#autoscale) and [horizontal pod autoscaler](/docs/tasks/run-application/horizontal-pod-autoscale/) document.
305
302
306
303
307
304
## In-place updates of resources
@@ -312,12 +309,12 @@ Sometimes it's necessary to make narrow, non-disruptive updates to resources you
312
309
313
310
It is suggested to maintain a set of configuration files in source control (see [configuration as code](http://martinfowler.com/bliki/InfrastructureAsCode.html)),
314
311
so that they can be maintained and versioned along with the code for the resources they configure.
315
-
Then, you can use [`kubectl apply`](/docs/user-guide/kubectl/{{page.version}}/#apply) to push your configuration changes to the cluster.
312
+
Then, you can use [`kubectl apply`](/docs/reference/generated/kubectl/kubectl-commands/#apply) to push your configuration changes to the cluster.
316
313
317
314
This command will compare the version of the configuration that you're pushing with the previous version and apply the changes you've made, without overwriting any automated changes to properties you haven't specified.
This allows you to do more significant changes more easily. Note that you can specify the editor with your `EDITOR` or `KUBE_EDITOR` environment variables.
353
350
354
-
For more information, please see [kubectl edit](/docs/user-guide/kubectl/{{page.version}}/#edit) document.
351
+
For more information, please see [kubectl edit](/docs/reference/generated/kubectl/kubectl-commands/#edit) document.
355
352
356
353
### kubectl patch
357
354
358
355
You can use `kubectl patch` to update API objects in place. This command supports JSON patch,
359
356
JSON merge patch, and strategic merge patch. See
360
357
[Update API Objects in Place Using kubectl patch](/docs/tasks/run-application/update-api-object-kubectl-patch/)
In some cases, you may need to update resource fields that cannot be updated once initialized, or you may just want to make a recursive change immediately, such as to fix broken pods created by a Deployment. To change such fields, use `replace --force`, which deletes and re-creates the resource. In this case, you can simply modify your original configuration file:
0 commit comments