Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f2ecee

Browse files
tompizmorchenopis
authored andcommitted
Add TCP socket health check example (kubernetes#3977)
* Add TCP socket health check example * Add test case for pod-with-tcp-socket-healthcheck
1 parent 8d20ed8 commit 9f2ecee

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

docs/user-guide/walkthrough/k8s201.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ Here is an example config for a Pod with an HTTP health check ([pod-with-http-he
216216

217217
{% include code.html language="yaml" file="pod-with-http-healthcheck.yaml" ghlink="/docs/user-guide/walkthrough/pod-with-http-healthcheck.yaml" %}
218218

219+
And here is an example config for a Pod with a TCP Socket health check ([pod-with-tcp-socket-healthcheck.yaml](/docs/user-guide/walkthrough/pod-with-tcp-socket-healthcheck.yaml)):
220+
221+
{% include code.html language="yaml" file="pod-with-tcp-socket-healthcheck.yaml" ghlink="/docs/user-guide/walkthrough/pod-with-tcp-socket-healthcheck.yaml" %}
219222

220223
For more information about health checking, see [Container Probes](/docs/user-guide/pod-states/#container-probes).
221224

docs/user-guide/walkthrough/pod-with-http-healthcheck.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: Pod
33
metadata:
4-
name: pod-with-healthcheck
4+
name: pod-with-http-healthcheck
55
spec:
66
containers:
77
- name: nginx
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: pod-with-tcp-socket-healthcheck
5+
spec:
6+
containers:
7+
- name: redis
8+
image: redis
9+
# defines the health checking
10+
livenessProbe:
11+
# a TCP socket probe
12+
tcpSocket:
13+
port: 6379
14+
# length of time to wait for a pod to initialize
15+
# after pod startup, before applying health checking
16+
initialDelaySeconds: 30
17+
timeoutSeconds: 1
18+
ports:
19+
- containerPort: 6379

test/examples_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,15 @@ func walkConfigFiles(inDir string, fn func(name, path string, data [][]byte)) er
215215
func TestExampleObjectSchemas(t *testing.T) {
216216
cases := map[string]map[string][]runtime.Object{
217217
"../docs/user-guide/walkthrough": {
218-
"deployment": {&extensions.Deployment{}},
219-
"deployment-update": {&extensions.Deployment{}},
220-
"pod-nginx": {&api.Pod{}},
221-
"pod-nginx-with-label": {&api.Pod{}},
222-
"pod-redis": {&api.Pod{}},
223-
"pod-with-http-healthcheck": {&api.Pod{}},
224-
"podtemplate": {&api.PodTemplate{}},
225-
"service": {&api.Service{}},
218+
"deployment": {&extensions.Deployment{}},
219+
"deployment-update": {&extensions.Deployment{}},
220+
"pod-nginx": {&api.Pod{}},
221+
"pod-nginx-with-label": {&api.Pod{}},
222+
"pod-redis": {&api.Pod{}},
223+
"pod-with-http-healthcheck": {&api.Pod{}},
224+
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
225+
"podtemplate": {&api.PodTemplate{}},
226+
"service": {&api.Service{}},
226227
},
227228
"../docs/user-guide/update-demo": {
228229
"kitten-rc": {&api.ReplicationController{}},

0 commit comments

Comments
 (0)