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

Kubernetes: Manageable Microservices

Avatar for Alex Couper Alex Couper
September 24, 2015

Kubernetes: Manageable Microservices

Talk given at Javascript Iceland 24 September 2015.

Introduction to kubernetes

Avatar for Alex Couper

Alex Couper

September 24, 2015
Tweet

Other Decks in Technology

Transcript

  1. Alex Couper Developer @ Azazo @couperalex Confessions: My JS ~=

    my Icelandic Vim skills of a CEO Hello!
  2. Containers in 2 mins • Define your application • Package

    all of the dependencies (from OS upwards) • Define what ports are exposed • Single, agreed format to handle in deployment for all your services. • (Plus some significant cost benefits)
  3. # # Elasticsearch Dockerfile # https://github.com/dockerfile/elasticsearch # # Pull base

    image. FROM dockerfile/java:oracle-java8 # Install Elasticsearch. RUN cd / && \ wget https://elasticsearch.org/download/elasticsearch.tar.gz \ && tar xvzf elasticsearch.tar.gz # Define default command. CMD ["/elasticsearch/bin/elasticsearch"] # Expose ports. # - 9200: HTTP # - 9300: transport EXPOSE 9200 EXPOSE 9300 An example docker image
  4. Problems you soon hit • How can I make sure

    I’ve got the right things deployed? • How can containers find each other when each layer is being switched out all the time? (discovery) • Was all this mess of containers worth it? • GIVE ME BACK MY MONOLITH!
  5. Kubernetes • One of many ways to solve the orchestration/discovery

    problem. • ~an open source equivalent of what Google uses to run all its software. • “Manage a cluster of linux containers as a single system”
  6. Basic Architecture For more detail see http://kubernetes.io/v1.0/docs/design/architecture.html Master Node 1

    Node 2 Node 3 Node 4 Kubernetes cluster API Calls Containers run here
  7. Pods • 1 or more container • Within a pod:

    ◦ Share network/port space ◦ Share access to disk specified • Each container has a “liveness probe” • Changeable labels Container 1 Container 2 Disk
  8. Replication Controllers • Responsible for checking that the state matches

    what you’ve dictated. ◦ Create containers if they are missing ◦ Remove containers if there are too many • Used for deployments - rolling updates, canary deploys.
  9. Services • How can our containers talk to each other?

    How do they know where to find each other? • A service targets a set of pods by label • Its name is available via DNS to all nodes in the cluster.
  10. Scheduler Kubernetes picks which nodes to run your pods on

    for you - based on resources and labels. If you have a db that needs ssd, you can say the machine needs ssd - and it’ll only run that pod on such a machine.
  11. Credits/References • Mandy Waite https://twitter.com/tekgrrl • Landing Page • Excellent

    article on microservice trade-offs by Martin Fowler • Kubernetes documentation • Google Container Engine documentation • https://github.com/alexcouper/kubeshark Experienced/interested in this stuff? Let’s chat! Slides will be published on speakerdeck. @couperalex