Upgrade to Pro — share decks privately, control downloads, hide ads and more …

KubeCon Talk 2016- Basics of Kubernetes Service Discovery

KubeCon Talk 2016- Basics of Kubernetes Service Discovery

Brandon Philips

November 08, 2016
Tweet

More Decks by Brandon Philips

Other Decks in Programming

Transcript

  1. 90+ Projects on GitHub, 1,000+ Contributors OPEN SOURCE Secure solutions,

    support plans, training + more ENTERPRISE CoreOS is Running the World’s Containers Linux
  2. - Use the quickstart tutorial - Or try out rkt

    quickstart - Ensure you get kubectl work: kubectl get nodes NAME STATUS AGE minikube Ready 6m minikube
  3. Fundamental API Server - API Server is bedrock of discovery

    - Available at well-known URL - Protected by TLS and accounts
  4. kubectl run nginx --image=nginx -l app=nginx kubectl get replicaset -l

    app=nginx kubectl get pods -l app=nginx -w Fundamental Labels
  5. - 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
  6. 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
  7. 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
  8. Copy/paste one-liner to forward DNS to localhost $ dig +vc

    -p 5300 @127.0.0.1 cluster.local kube-dns proxy to localhost
  9. $ 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
  10. $ 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