Brandon Philips
@brandonphilips | brandon@coreos.com | coreos.com
Kubernetes Service Discovery
Fundamentals and Extensions
Slide 2
Slide 2 text
90+ Projects on GitHub, 1,000+ Contributors
OPEN SOURCE
Secure solutions, support plans, training + more
ENTERPRISE
CoreOS is Running the World’s Containers
Linux
Slide 3
Slide 3 text
Examples
minikube
Slide 4
Slide 4 text
- Use the quickstart tutorial
- Or try out rkt quickstart
- Ensure you get kubectl work: kubectl get nodes
NAME STATUS AGE
minikube Ready 6m
minikube
Slide 5
Slide 5 text
Overview
Label Service Discovery
Slide 6
Slide 6 text
Fundamental API Server
- API Server is bedrock of discovery
- Available at well-known URL
- Protected by TLS and accounts
Slide 7
Slide 7 text
Fundamental Labels
Slide 8
Slide 8 text
Fundamental Labels
Slide 9
Slide 9 text
kubectl run nginx --image=nginx -l app=nginx
kubectl get replicaset -l app=nginx
kubectl get pods -l app=nginx -w
Fundamental Labels
Slide 10
Slide 10 text
Fundamental Labels
Slide 11
Slide 11 text
kubectl expose deployment nginx --port 80 --type=NodePort
minikube service nginx
Fundamental Labels
Slide 12
Slide 12 text
Overview
Above the API
Slide 13
Slide 13 text
- Configured statically in kubelet (--cluster-dns)
- Injected into /etc/resolv.conf of containers
- Meta alert: DNS Service IP backed by Kubernetes
- kubectl describe service -n kube-system kube-dns
DNS Add-on
Slide 14
Slide 14 text
Name: kube-dns
Namespace: kube-system
Labels: k8s-app=kube-dns
Selector: k8s-app=kube-dns
Type: ClusterIP
IP: 10.0.0.10
Port: dns 53/UDP
Endpoints: 10.1.0.3:53
kube-dns the service
Slide 15
Slide 15 text
DNS Add-on Basics
API Server kube-dns
Service
10.0.0.10
dig +vc -p @10.0.0.10 kube-dns.kube-system.svc.cluster.local
;; QUESTION SECTION:
;kube-dns.kube-system.svc.cluster.local. IN A
;; ANSWER SECTION:
kube-dns.kube-system.svc.cluster.local. 30 IN A 10.0.0.10
Slide 16
Slide 16 text
Copy/paste one-liner to forward DNS to localhost
$ dig +vc -p 5300 @127.0.0.1 cluster.local
kube-dns proxy to localhost
Slide 17
Slide 17 text
$ dig A etcd-0000.default.cluster.local
etcde-0001.default.svc.cluster.local. 30 IN A 10.0.0.40
$ dig SRV _client._tcp.etcd-0000.default.cluster.local
IN SRV 10 100 2379 etcde-0001.default.svc.cluster.local.
DNS Add-on - Records
Slide 18
Slide 18 text
$ dig A etcd-0000
IN A 10.0.0.40
$ dig A etcd-0000.default
IN A 10.0.0.40
DNS Add-on - Search
Slide 19
Slide 19 text
Full docs are comprehensive
I helped write them :)
http://kubernetes.io/docs/admin/dns/
kube-dns full docs
Slide 20
Slide 20 text
tectonic.com/summit - @TectonicSummit
December 12 & 13 2016 - New York City
Slide 21
Slide 21 text
Thank you!
Brandon Philips
@brandonphilips | brandon@coreos.com | tectonic.com
We’re hiring in all departments! Email: careers@coreos.com Positions: coreos.com/ careers