Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fbe7cba

Browse files
committedSep 12, 2017
Update kubectl patch doc to use apps/v1beta2 APIs
1 parent 97f089e commit fbe7cba

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed
 

‎cn/docs/tasks/run-application/deployment-patch-demo.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
apiVersion: apps/v1beta1
1+
apiVersion: apps/v1beta2
22
kind: Deployment
33
metadata:
44
name: patch-demo
55
spec:
66
replicas: 2
7+
selector:
8+
matchLabels:
9+
app: nginx
710
template:
811
metadata:
912
labels:

‎docs/tasks/run-application/deployment-patch-demo.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
apiVersion: apps/v1beta1
1+
apiVersion: apps/v1beta2
22
kind: Deployment
33
metadata:
44
name: patch-demo
55
spec:
66
replicas: 2
7+
selector:
8+
matchLabels:
9+
app: nginx
710
template:
811
metadata:
912
labels:

‎docs/tasks/run-application/update-api-object-kubectl-patch.md

+14-20
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,12 @@ get terminated and replaced by new ones.
5454
At this point, each Pod has one Container that runs the nginx image. Now suppose
5555
you want each Pod to have two containers: one that runs nginx and one that runs redis.
5656

57-
Create a file named `patch-file.yaml` that has this content:
57+
Create a file named `patch-file.yaml` that has `.spec.template.spec.containers` field as follow:
5858

5959
```shell
60-
spec:
61-
template:
62-
spec:
63-
containers:
64-
- name: patch-demo-ctr-2
65-
image: redis
60+
containers:
61+
- name: patch-demo-ctr-2
62+
image: redis
6663
```
6764

6865
Patch your Deployment:
@@ -81,14 +78,14 @@ The output shows that the PodSpec in the Deployment has two Containers:
8178

8279
```shell
8380
containers:
84-
- image: nginx
85-
imagePullPolicy: Always
86-
name: patch-demo-ctr
87-
...
8881
- image: redis
8982
imagePullPolicy: Always
9083
name: patch-demo-ctr-2
9184
...
85+
- image: nginx
86+
imagePullPolicy: Always
87+
name: patch-demo-ctr
88+
...
9289
```
9390

9491
View the Pods associated with your patched Deployment:
@@ -118,10 +115,10 @@ The output shows that the Pod has two Containers: one running nginx and one runn
118115

119116
```
120117
containers:
121-
- image: nginx
122-
...
123118
- image: redis
124119
...
120+
- image: nginx
121+
...
125122
```
126123

127124
### Notes on the strategic merge patch
@@ -160,15 +157,12 @@ The default value for the `type` parameter is `strategic`. So in the preceding e
160157
did a strategic merge patch.
161158

162159
Next, do a JSON merge patch on your same Deployment. Create a file named `patch-file-2.yaml`
163-
that has this content:
160+
that has `.spec.template.spec.containers` field as follow:
164161

165162
```shell
166-
spec:
167-
template:
168-
spec:
169-
containers:
170-
- name: patch-demo-ctr-3
171-
image: gcr.io/google-samples/node-hello:1.0
163+
containers:
164+
- name: patch-demo-ctr-3
165+
image: gcr.io/google-samples/node-hello:1.0
172166
```
173167

174168
In your patch command, set `type` to `merge`:

0 commit comments

Comments
 (0)
Please sign in to comment.