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

Hitchhiker's Guide to Microservices, Containers...

Hitchhiker's Guide to Microservices, Containers, and Kubernetes

Talk provides a high-level journey through the lifecycle of microservices development. We will create a microservice, create a container, and deploy it to a Kubernetes cluster.

Avatar for runlevl4

runlevl4

June 13, 2020

Other Decks in Technology

Transcript

  1. • 20+ year IT veteran • 13 years developing/managing web

    services • OpenShift cluster admin • Certified Kubernetes Application Developer BIO
  2. Confidential, Proprietary and/or Trade Secret | TM SM ® Trademark(s)

    of Black Knight IP Holding Company, LLC, or an affiliate. © 2019 Black Knight Financial Technology Solutions, LLC. All Rights Reserved.
  3. • High Cohesion –The measure of how strongly related and

    focused the responsibilities of our microservices are. • Low Coupling –The measure of how strongly one microservice is connected to, has knowledge of, or relies on other microservices. KEY TENETS OF MICROSERVICES
  4. • Different technologies (polyglot) • Resilience • Scaling • Composability

    • Easier to understand and onboard new developers BENEFITS OF MICROSERVICES
  5. 9 Confidential, Proprietary and/or Trade Secret | TM SM ®

    Trademark(s) of Black Knight IP Holding Company, LLC, or an affiliate. © 2019 Black Knight Financial Technology Solutions, LLC. All Rights Reserved.
  6. • A lightweight, standalone, executable package of software that includes

    everything needed to run an application: • Code • Runtime • System tools • System libraries • Settings • Runs quickly and reliably from one environment to another WHAT IS A CONTAINER?
  7. • Limit the amount of resources a process can consume

    (CPU, memory, network bandwidth, etc.) • Allow complete isolation of an application's view of the operating environment, including process trees, networking, user IDs and mounted file systems. Process isolation Resource management WHAT DOES A CONTAINER PROVIDE?
  8. Intermediate layers to add tools, applications, etc. to the container.

    Shared area from the host OS which performs key operating tasks such as running processes, managing I/O, etc. Small, writable layer for temporary changes to the container. “Base” image which creates the foundation for the container. MICROSERVICES TO CONTAINERS
  9. FROM openjdk:8-jre-alpine ARG JAR ARG CONFIG_SERVER ENV JAR ${JAR:-app.jar} ENV

    CONFIG_SERVER ${CONFIG_SERVER:-http://localhost:8280} RUN adduser -D -h /home/app -u 1000 app USER 1000 COPY target/${JAR} /app/app.jar EXPOSE 8080 ENTRYPOINT ["java", "-jar", "/app/app.jar", "--server.port=8080” ß Image to build from ß Declare command-line args ß Declare environment variables ß Create new user and switch to it. *** Avoid root! *** ß Copy Java artifact to image and expose HTTP port ß Start application BUILDING AN IMAGE: THE DOCKERFILE
  10. • Pods are the atomic unit on the Kubernetes platform.

    • A Pod models an application-specific "logical host" and can contain different application containers which are relatively tightly coupled. CONTAINERS à PODS
  11. Mounting storage systems Distributing secrets Self-healing Replicating application instances Autoscaling

    Naming and discovery Load balancing Rolling updates Resource monitoring Logging Automatic bin packing Authentication/Authorization WHAT DOES KUBERNETES ORCHESTRATE?
  12. Node 1 Node 2 Node 3 Deployment Deployment 10.10.0.1 10.10.0.2

    10.10.0.3 10.10.0.4 10.10.0.5 10.10.0.6 10.10.0.7 10.10.0.8 Ingress Ingress External Service Service Internal A OOM
  13. SERVICE & DEPLOYMENTS kubelet kube-proxy kubelet kube-proxy kubelet kube-proxy Node

    1 Container Network Node 2 Node 3 Users api-server controller- manager scheduler etcd Master Admin/ Operator
  14. CLOSING THOUGHTS • Microservices may not always be the right

    answer. • Evaluate your needs and account for the added complexity and organizational challenges you may face. • Don’t be afraid to evaluate, reassess, and possibly abandon microservices if they end up not being a good fit. • Don’t use microservice just to build distributed monoliths.
  15. USEFUL RESOURCES • https://kubernetes.io • https://kube.academy • https://www.katacoda.com/courses/kubernetes Hands-On Labs

    • https://www.edx.org/course/introduction-to-kubernetes • https://www.runlevl4.com • https://github.com/runlevl4 • https://gist.github.com/runlevl4 • Twitter: @runlevl4 Email: [email protected]