From 7b9f9e23c0a38d4ba78a686c5f7e2924c6a8093e Mon Sep 17 00:00:00 2001 From: Jerome Petazzoni Date: Sun, 8 Apr 2018 11:10:07 -0500 Subject: [PATCH] Add headless services --- slides/kube/kubectlexpose.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/slides/kube/kubectlexpose.md b/slides/kube/kubectlexpose.md index 1010ca18..fb9b30ce 100644 --- a/slides/kube/kubectlexpose.md +++ b/slides/kube/kubectlexpose.md @@ -53,6 +53,26 @@ The `LoadBalancer` type is currently only available on AWS, Azure, and GCE. --- +## Headless services + +- A "headless service" is a service that doesn't have a virtual IP address + +- Since there is no virtual IP address, there is no load balancer either + +- This is useful if we want to connect directly to the pods + +- We can discover the pod IP addresses: + + - by querying the Kubernetes API + - by querying the internal DNS (if we use `kube-dns`) + - with other custom mechanisms (e.g. running Consul, Zookeeper...) + +- A headless service is obtained by setting the `clusterIP` field to `None` + + (Either with `--cluster-ip=None`, or by providing a custom YAML) + +--- + ## Running containers with open ports - Since `ping` doesn't have anything to connect to, we'll have to run something else