New deployments endpoint (#2986)
* Update deployments for 1.6 * Update all deployments in docs to use the new endpointreviewable/pr2976/r1
parent
ddc206709f
commit
c4dca21649
|
@ -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.
|
||||
|
||||
```
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -363,7 +363,7 @@ $ kubectl get deployment my-nginx -o yaml
|
|||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
...
|
||||
spec:
|
||||
|
@ -382,7 +382,7 @@ $ kubectl get pod my-nginx-1jgkf -o yaml
|
|||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
...
|
||||
spec:
|
||||
|
|
|
@ -11,7 +11,7 @@ spec:
|
|||
selector:
|
||||
app: nginx
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: curl-deployment
|
||||
|
|
|
@ -17,7 +17,7 @@ spec:
|
|||
selector:
|
||||
run: my-nginx
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -198,7 +198,7 @@ Now, we need to create a Deployment that will run the database. I'm using a Depl
|
|||
### `db-deployment.yml`
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mongo-deployment
|
||||
|
@ -317,7 +317,7 @@ Let's look at the Deployment configuration:
|
|||
### `web-deployment.yml`
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: web-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: kube-dns-autoscaler
|
||||
|
|
|
@ -12,7 +12,7 @@ spec:
|
|||
targetPort: 80
|
||||
type: LoadBalancer
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frontend
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hello
|
||||
|
|
|
@ -89,7 +89,7 @@ metadata:
|
|||
# This is the json representation of simple_deployment.yaml
|
||||
# It was written by kubectl apply when the object was created
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"extensions/v1beta1","kind":"Deployment",
|
||||
{"apiVersion":"apps/v1beta1","kind":"Deployment",
|
||||
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
|
||||
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"nginx"}},
|
||||
"spec":{"containers":[{"image":"nginx:1.7.9","name":"nginx",
|
||||
|
@ -160,7 +160,7 @@ metadata:
|
|||
# This is the json representation of simple_deployment.yaml
|
||||
# It was written by kubectl apply when the object was created
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"extensions/v1beta1","kind":"Deployment",
|
||||
{"apiVersion":"apps/v1beta1","kind":"Deployment",
|
||||
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
|
||||
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"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:
|
||||
|
||||
```
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -212,7 +212,7 @@ metadata:
|
|||
# note that the annotation does not contain replicas
|
||||
# because it was not updated through apply
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"extensions/v1beta1","kind":"Deployment",
|
||||
{"apiVersion":"apps/v1beta1","kind":"Deployment",
|
||||
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
|
||||
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"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.
|
||||
|
||||
```shell
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -272,7 +272,7 @@ metadata:
|
|||
# The annotation contains the updated image to nginx 1.11.9,
|
||||
# but does not contain the updated replicas to 2
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"extensions/v1beta1","kind":"Deployment",
|
||||
{"apiVersion":"apps/v1beta1","kind":"Deployment",
|
||||
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
|
||||
"spec":{"template":{"metadata":{"labels":{"app":"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:
|
||||
|
||||
```shell
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -403,7 +403,7 @@ metadata:
|
|||
# note that the annotation does not contain replicas
|
||||
# because it was not updated through apply
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"extensions/v1beta1","kind":"Deployment",
|
||||
{"apiVersion":"apps/v1beta1","kind":"Deployment",
|
||||
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
|
||||
"spec":{"minReadySeconds":5,"template":{"metadata":{"labels":{"app":"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:
|
||||
|
||||
```shell
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
|
@ -454,7 +454,7 @@ metadata:
|
|||
# The annotation contains the updated image to nginx 1.11.9,
|
||||
# but does not contain the updated replicas to 2
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"extensions/v1beta1","kind":"Deployment",
|
||||
{"apiVersion":"apps/v1beta1","kind":"Deployment",
|
||||
"metadata":{"annotations":{},"name":"nginx-deployment","namespace":"default"},
|
||||
"spec":{"template":{"metadata":{"labels":{"app":"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.
|
||||
|
||||
```shell
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
# ...
|
||||
spec:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -20,7 +20,7 @@ spec:
|
|||
requests:
|
||||
storage: 20Gi
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mysql
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: curl-deployment
|
||||
|
|
|
@ -88,7 +88,7 @@ Note that this is the same as if you had started the `Deployment` with
|
|||
the following YAML:
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hostnames
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -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.
|
||||
|
||||
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
|
||||
up (1 max unavailable).
|
||||
default, it ensures that at least 25% less than the desired number of Pods are
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
(you can change that by specifying [revision history limit](/docs/user-guide/deployments/#revision-history-limit)).
|
||||
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 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
|
||||
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
|
||||
|
||||
`.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
|
||||
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).
|
||||
|
@ -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.
|
||||
|
||||
`.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.
|
||||
In this case, a new deployment rollout cannot be undone, since its revision history is cleaned up.
|
||||
|
|
|
@ -5,7 +5,7 @@ metadata:
|
|||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
name: php-apache
|
||||
minReplicas: 1
|
||||
|
|
|
@ -147,7 +147,7 @@ metadata:
|
|||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
name: php-apache
|
||||
minReplicas: 1
|
||||
|
@ -227,7 +227,7 @@ metadata:
|
|||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
name: php-apache
|
||||
minReplicas: 1
|
||||
|
@ -280,7 +280,7 @@ metadata:
|
|||
namespace: default
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
name: php-apache
|
||||
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.
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -11,7 +11,7 @@ spec:
|
|||
selector:
|
||||
app: nginx
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx
|
||||
|
|
|
@ -17,7 +17,7 @@ spec:
|
|||
selector:
|
||||
run: my-nginx
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: redis
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: redis
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: redis
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-nginx
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
|
|
Loading…
Reference in New Issue