Add TCP socket health check example (#3977)
* Add TCP socket health check example * Add test case for pod-with-tcp-socket-healthcheck
This commit is contained in:
parent
8d20ed8580
commit
9f2ecee260
|
@ -216,6 +216,9 @@ Here is an example config for a Pod with an HTTP health check ([pod-with-http-he
|
||||||
|
|
||||||
{% include code.html language="yaml" file="pod-with-http-healthcheck.yaml" ghlink="/docs/user-guide/walkthrough/pod-with-http-healthcheck.yaml" %}
|
{% include code.html language="yaml" file="pod-with-http-healthcheck.yaml" ghlink="/docs/user-guide/walkthrough/pod-with-http-healthcheck.yaml" %}
|
||||||
|
|
||||||
|
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)):
|
||||||
|
|
||||||
|
{% include code.html language="yaml" file="pod-with-tcp-socket-healthcheck.yaml" ghlink="/docs/user-guide/walkthrough/pod-with-tcp-socket-healthcheck.yaml" %}
|
||||||
|
|
||||||
For more information about health checking, see [Container Probes](/docs/user-guide/pod-states/#container-probes).
|
For more information about health checking, see [Container Probes](/docs/user-guide/pod-states/#container-probes).
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: pod-with-healthcheck
|
name: pod-with-http-healthcheck
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: nginx
|
- name: nginx
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: pod-with-tcp-socket-healthcheck
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: redis
|
||||||
|
# defines the health checking
|
||||||
|
livenessProbe:
|
||||||
|
# a TCP socket probe
|
||||||
|
tcpSocket:
|
||||||
|
port: 6379
|
||||||
|
# length of time to wait for a pod to initialize
|
||||||
|
# after pod startup, before applying health checking
|
||||||
|
initialDelaySeconds: 30
|
||||||
|
timeoutSeconds: 1
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
|
@ -215,14 +215,15 @@ func walkConfigFiles(inDir string, fn func(name, path string, data [][]byte)) er
|
||||||
func TestExampleObjectSchemas(t *testing.T) {
|
func TestExampleObjectSchemas(t *testing.T) {
|
||||||
cases := map[string]map[string][]runtime.Object{
|
cases := map[string]map[string][]runtime.Object{
|
||||||
"../docs/user-guide/walkthrough": {
|
"../docs/user-guide/walkthrough": {
|
||||||
"deployment": {&extensions.Deployment{}},
|
"deployment": {&extensions.Deployment{}},
|
||||||
"deployment-update": {&extensions.Deployment{}},
|
"deployment-update": {&extensions.Deployment{}},
|
||||||
"pod-nginx": {&api.Pod{}},
|
"pod-nginx": {&api.Pod{}},
|
||||||
"pod-nginx-with-label": {&api.Pod{}},
|
"pod-nginx-with-label": {&api.Pod{}},
|
||||||
"pod-redis": {&api.Pod{}},
|
"pod-redis": {&api.Pod{}},
|
||||||
"pod-with-http-healthcheck": {&api.Pod{}},
|
"pod-with-http-healthcheck": {&api.Pod{}},
|
||||||
"podtemplate": {&api.PodTemplate{}},
|
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
|
||||||
"service": {&api.Service{}},
|
"podtemplate": {&api.PodTemplate{}},
|
||||||
|
"service": {&api.Service{}},
|
||||||
},
|
},
|
||||||
"../docs/user-guide/update-demo": {
|
"../docs/user-guide/update-demo": {
|
||||||
"kitten-rc": {&api.ReplicationController{}},
|
"kitten-rc": {&api.ReplicationController{}},
|
||||||
|
|
Loading…
Reference in New Issue