New deployments endpoint (#2986)

* Update deployments for 1.6

* Update all deployments in docs to use the new endpoint
This commit is contained in:
Maciej Szulik
2017-03-24 19:03:01 +01:00
committed by Andrew Chen
parent ddc206709f
commit c4dca21649
41 changed files with 135 additions and 135 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ talk to the API server. Accounts may be explicitly associated with pods using th
NOTE: `serviceAccountName` is usually omitted because this is done automatically. NOTE: `serviceAccountName` is usually omitted because this is done automatically.
``` ```
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
labels: labels:
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -363,7 +363,7 @@ $ kubectl get deployment my-nginx -o yaml
``` ```
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
... ...
spec: spec:
@@ -382,7 +382,7 @@ $ kubectl get pod my-nginx-1jgkf -o yaml
``` ```
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
... ...
spec: spec:
@@ -11,7 +11,7 @@ spec:
selector: selector:
app: nginx app: nginx
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: curl-deployment name: curl-deployment
@@ -17,7 +17,7 @@ spec:
selector: selector:
run: my-nginx run: my-nginx
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
+2 -2
View File
@@ -198,7 +198,7 @@ Now, we need to create a Deployment that will run the database. I'm using a Depl
### `db-deployment.yml` ### `db-deployment.yml`
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: mongo-deployment name: mongo-deployment
@@ -317,7 +317,7 @@ Let's look at the Deployment configuration:
### `web-deployment.yml` ### `web-deployment.yml`
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: web-deployment name: web-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: kube-dns-autoscaler name: kube-dns-autoscaler
+1 -1
View File
@@ -12,7 +12,7 @@ spec:
targetPort: 80 targetPort: 80
type: LoadBalancer type: LoadBalancer
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: frontend name: frontend
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: hello name: hello
@@ -89,7 +89,7 @@ metadata:
# This is the json representation of simple_deployment.yaml # This is the json representation of simple_deployment.yaml
# It was written by kubectl apply when the object was created # It was written by kubectl apply when the object was created
kubectl.kubernetes.io/last-applied-configuration: | kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment", {"apiVersion":"apps/v1beta1","kind":"Deployment",
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"}, "metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}}, "spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}},
"spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx", "spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx",
@@ -160,7 +160,7 @@ metadata:
# This is the json representation of simple_deployment.yaml # This is the json representation of simple_deployment.yaml
# It was written by kubectl apply when the object was created # It was written by kubectl apply when the object was created
kubectl.kubernetes.io/last-applied-configuration: | kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment", {"apiVersion":"apps/v1beta1","kind":"Deployment",
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"}, "metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}}, "spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}},
"spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx", "spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx",
@@ -204,7 +204,7 @@ The output shows that the `replicas` field has been set to 2, and the `last-appl
annotation does not contain a `replicas` field: annotation does not contain a `replicas` field:
``` ```
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
annotations: annotations:
@@ -212,7 +212,7 @@ metadata:
# note that the annotation does not contain replicas # note that the annotation does not contain replicas
# because it was not updated through apply # because it was not updated through apply
kubectl.kubernetes.io/last-applied-configuration: | kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment", {"apiVersion":"apps/v1beta1","kind":"Deployment",
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"}, "metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}}, "spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}},
"spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx", "spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx",
@@ -264,7 +264,7 @@ The output shows the following changes to the live configuration:
- The `last-applied-configuration` annotation no longer contains the `minReadySeconds` field. - The `last-applied-configuration` annotation no longer contains the `minReadySeconds` field.
```shell ```shell
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
annotations: annotations:
@@ -272,7 +272,7 @@ metadata:
# The annotation contains the updated image to nginx 1.11.9, # The annotation contains the updated image to nginx 1.11.9,
# but does not contain the updated replicas to 2 # but does not contain the updated replicas to 2
kubectl.kubernetes.io/last-applied-configuration: | kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment", {"apiVersion":"apps/v1beta1","kind":"Deployment",
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"}, "metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
"spec":{"template":{"metadata":{"labels":{"app":"nginx"}}, "spec":{"template":{"metadata":{"labels":{"app":"nginx"}},
"spec":{"containers":[{"image":"nginx:1.11.9","name":"nginx", "spec":{"containers":[{"image":"nginx:1.11.9","name":"nginx",
@@ -395,7 +395,7 @@ Here's an example. Suppose this is the configuration file for a Deployment objec
Also, suppose this is the live configuration for the same Deployment object: Also, suppose this is the live configuration for the same Deployment object:
```shell ```shell
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
annotations: annotations:
@@ -403,7 +403,7 @@ metadata:
# note that the annotation does not contain replicas # note that the annotation does not contain replicas
# because it was not updated through apply # because it was not updated through apply
kubectl.kubernetes.io/last-applied-configuration: | kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment", {"apiVersion":"apps/v1beta1","kind":"Deployment",
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"}, "metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}}, "spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}},
"spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx", "spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx",
@@ -446,7 +446,7 @@ Here are the merge calculations that would be performed by `kubectl apply`:
Here is the live configuration that is the result of the merge: Here is the live configuration that is the result of the merge:
```shell ```shell
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
annotations: annotations:
@@ -454,7 +454,7 @@ metadata:
# The annotation contains the updated image to nginx 1.11.9, # The annotation contains the updated image to nginx 1.11.9,
# but does not contain the updated replicas to 2 # but does not contain the updated replicas to 2
kubectl.kubernetes.io/last-applied-configuration: | kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Deployment", {"apiVersion":"apps/v1beta1","kind":"Deployment",
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"}, "metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
"spec":{"template":{"metadata":{"labels":{"app":"nginx"}}, "spec":{"template":{"metadata":{"labels":{"app":"nginx"}},
"spec":{"containers":[{"image":"nginx:1.11.9","name":"nginx", "spec":{"containers":[{"image":"nginx:1.11.9","name":"nginx",
@@ -693,7 +693,7 @@ The output shows that the API server set several fields to default values in the
configuration. These fields were not specified in the configuration file. configuration. These fields were not specified in the configuration file.
```shell ```shell
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
# ... # ...
spec: spec:
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -20,7 +20,7 @@ spec:
requests: requests:
storage: 20Gi storage: 20Gi
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: mysql name: mysql
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: curl-deployment name: curl-deployment
+1 -1
View File
@@ -88,7 +88,7 @@ Note that this is the same as if you had started the `Deployment` with
the following YAML: the following YAML:
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: hostnames name: hostnames
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
+7 -7
View File
@@ -143,10 +143,10 @@ nginx-deployment-1564180365-z9gth 1/1 Running 0 14s
Next time we want to update these Pods, we only need to update the Deployment's pod template again. Next time we want to update these Pods, we only need to update the Deployment's pod template again.
Deployment can ensure that only a certain number of Pods may be down while they are being updated. By Deployment can ensure that only a certain number of Pods may be down while they are being updated. By
default, it ensures that at least 1 less than the desired number of Pods are default, it ensures that at least 25% less than the desired number of Pods are
up (1 max unavailable). up (25% max unavailable).
Deployment can also ensure that only a certain number of Pods may be created above the desired number of Pods. By default, it ensures that at most 1 more than the desired number of Pods are up (1 max surge). Deployment can also ensure that only a certain number of Pods may be created above the desired number of Pods. By default, it ensures that at most 25% more than the desired number of Pods are up (25% max surge).
For example, if you look at the above Deployment closely, you will see that For example, if you look at the above Deployment closely, you will see that
it first created a new Pod, then deleted some old Pods and created new ones. It it first created a new Pod, then deleted some old Pods and created new ones. It
@@ -204,8 +204,8 @@ before changing course.
## Rolling Back a Deployment ## Rolling Back a Deployment
Sometimes you may want to rollback a Deployment; for example, when the Deployment is not stable, such as crash looping. Sometimes you may want to rollback a Deployment; for example, when the Deployment is not stable, such as crash looping.
By default, all of the Deployment's rollout history is kept in the system so that you can rollback anytime you want By default, two previous Deployment's rollout history are kept in the system so that you can rollback anytime you want
(you can change that by specifying [revision history limit](/docs/user-guide/deployments/#revision-history-limit)). (you can change that by modifying [revision history limit](/docs/user-guide/deployments/#revision-history-limit)).
**Note:** a Deployment's revision is created when a Deployment's rollout is triggered. This means that the new revision is created **Note:** a Deployment's revision is created when a Deployment's rollout is triggered. This means that the new revision is created
if and only if the Deployment's pod template (i.e. `.spec.template`) is changed, e.g. updating labels or container images of the template. if and only if the Deployment's pod template (i.e. `.spec.template`) is changed, e.g. updating labels or container images of the template.
@@ -774,7 +774,7 @@ If specified, this field needs to be greater than `.spec.minReadySeconds`.
### Min Ready Seconds ### Min Ready Seconds
`.spec.minReadySeconds` is an optional field that specifies the `.spec.minReadySeconds` is an optional field (with default value of 600s) that specifies the
minimum number of seconds for which a newly created Pod should be ready minimum number of seconds for which a newly created Pod should be ready
without any of its containers crashing, for it to be considered available. without any of its containers crashing, for it to be considered available.
This defaults to 0 (the Pod will be considered available as soon as it is ready). This defaults to 0 (the Pod will be considered available as soon as it is ready).
@@ -792,7 +792,7 @@ To learn more about when a Pod is considered ready, see [Container Probes](/docs
A deployment's revision history is stored in the replica sets it controls. A deployment's revision history is stored in the replica sets it controls.
`.spec.revisionHistoryLimit` is an optional field that specifies the number of old Replica Sets to retain to allow rollback. Its ideal value depends on the frequency and stability of new deployments. All old Replica Sets will be kept by default, consuming resources in `etcd` and crowding the output of `kubectl get rs`, if this field is not set. The configuration of each Deployment revision is stored in its Replica Sets; therefore, once an old Replica Set is deleted, you lose the ability to rollback to that revision of Deployment. `.spec.revisionHistoryLimit` is an optional field (with default value of two) that specifies the number of old Replica Sets to retain to allow rollback. Its ideal value depends on the frequency and stability of new deployments. All old Replica Sets will be kept by default, consuming resources in `etcd` and crowding the output of `kubectl get rs`, if this field is not set. The configuration of each Deployment revision is stored in its Replica Sets; therefore, once an old Replica Set is deleted, you lose the ability to rollback to that revision of Deployment.
More specifically, setting this field to zero means that all old replica sets with 0 replica will be cleaned up. More specifically, setting this field to zero means that all old replica sets with 0 replica will be cleaned up.
In this case, a new deployment rollout cannot be undone, since its revision history is cleaned up. In this case, a new deployment rollout cannot be undone, since its revision history is cleaned up.
@@ -5,7 +5,7 @@ metadata:
namespace: default namespace: default
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
name: php-apache name: php-apache
minReplicas: 1 minReplicas: 1
@@ -147,7 +147,7 @@ metadata:
namespace: default namespace: default
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
name: php-apache name: php-apache
minReplicas: 1 minReplicas: 1
@@ -227,7 +227,7 @@ metadata:
namespace: default namespace: default
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
name: php-apache name: php-apache
minReplicas: 1 minReplicas: 1
@@ -280,7 +280,7 @@ metadata:
namespace: default namespace: default
spec: spec:
scaleTargetRef: scaleTargetRef:
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
name: php-apache name: php-apache
minReplicas: 1 minReplicas: 1
@@ -17,7 +17,7 @@ your pods. But there are a number of ways to get even more information about you
For this example we'll use a Deployment to create two pods, similar to the earlier example. For this example we'll use a Deployment to create two pods, similar to the earlier example.
```yaml ```yaml
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
+1 -1
View File
@@ -11,7 +11,7 @@ spec:
selector: selector:
app: nginx app: nginx
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx name: nginx
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx name: nginx
+1 -1
View File
@@ -17,7 +17,7 @@ spec:
selector: selector:
run: my-nginx run: my-nginx
--- ---
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: redis name: redis
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: redis name: redis
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: redis name: redis
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: my-nginx name: my-nginx
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: apps/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
name: nginx-deployment name: nginx-deployment