Skip to content

Commit 6a6bf06

Browse files
authored
Merge pull request #40230 from chirag0002/duplicated-examples
removed duplicated examples
2 parents 355bae5 + 9d5ab09 commit 6a6bf06

File tree

2 files changed

+16
-45
lines changed

2 files changed

+16
-45
lines changed

content/en/docs/tutorials/services/pods-and-endpoint-termination-flow.md

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -38,53 +38,13 @@ Let's say you have a Deployment containing of a single `nginx` replica
3838

3939
{{% code file="service/pod-with-graceful-termination.yaml" %}}
4040

41-
```yaml
42-
apiVersion: apps/v1
43-
kind: Deployment
44-
metadata:
45-
name: nginx-deployment
46-
labels:
47-
app: nginx
48-
spec:
49-
replicas: 1
50-
selector:
51-
matchLabels:
52-
app: nginx
53-
template:
54-
metadata:
55-
labels:
56-
app: nginx
57-
spec:
58-
terminationGracePeriodSeconds: 120 # extra long grace period
59-
containers:
60-
- name: nginx
61-
image: nginx:latest
62-
ports:
63-
- containerPort: 80
64-
lifecycle:
65-
preStop:
66-
exec:
67-
# Real life termination may take any time up to terminationGracePeriodSeconds.
68-
# In this example - just hang around for at least the duration of terminationGracePeriodSeconds,
69-
# at 120 seconds container will be forcibly terminated.
70-
# Note, all this time nginx will keep processing requests.
71-
command: [
72-
"/bin/sh", "-c", "sleep 180"
73-
]
41+
{{< codenew file="service/explore-graceful-termination-nginx.yaml" >}}
7442

75-
---
43+
Now create the Deployment Pod and Service using the above files:
7644

77-
apiVersion: v1
78-
kind: Service
79-
metadata:
80-
name: nginx-service
81-
spec:
82-
selector:
83-
app: nginx
84-
ports:
85-
- protocol: TCP
86-
port: 80
87-
targetPort: 80
45+
```shell
46+
kubectl apply -f pod-with-graceful-termination.yaml
47+
kubectl apply -f explore-graceful-termination-nginx.yaml
8848
```
8949

9050
Once the Pod and Service are running, you can get the name of any associated EndpointSlices:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: nginx-service
5+
spec:
6+
selector:
7+
app: nginx
8+
ports:
9+
- protocol: TCP
10+
port: 80
11+
targetPort: 80

0 commit comments

Comments
 (0)