Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Architecting the Future: Abstractions and Metadata - BSidesKC

206 views

Published on

Kubernetes and Docker are two of the top open source projects, and they’re built around abstractions and metadata. These two concepts are the key to architecting in the future. Come with me as I dig a little deeper into these concepts within k8s and Docker and provide some examples from my own work.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Architecting the Future: Abstractions and Metadata - BSidesKC

  1. 1. Thank you to our BSidesKC 2017 sponsors!
  2. 2. Architecting the Future Abstractions and Metadata Dan Barker @barkerd427 danbarker.codes
  3. 3. The current data center is...challenging... RHEL 6.9 Dev RHEL 6.8 Test RHEL 6.6 Prod Dev Test Prod RHEL 6.7 Prod Admin Admin Admin Admin Admin Admin Dev RHEL 6.7 Dev RHEL 6.4 Dev RHEL 6.8 Dev Ubuntu Trusty RHEL 6.9 Dev RHEL 6.6 Dev Ubuntu Trusty RHEL 6.7 Dev RHEL 6.4 Dev RHEL 6.8 Dev Ubuntu Trusty RHEL 6.9 Dev RHEL 6.6 Dev RHEL 6.7 Dev RHEL 6.4 Dev RHEL 6.8 Dev Ubuntu Trusty RHEL 6.9 Dev RHEL 6.6 Dev @barkerd427
  4. 4. The new data center is understandable and usable. Developer Access Production Controlled Network Storage Compute Platform Deployment Pipeline RHEL 6.9 App1 RHEL 6.9 App1 RHEL 6.9 App1 RHEL 6.9 App1 RHEL 6.9 App1 RHEL 6.9 App1 RHEL 6.9 App2 RHEL 6.9 App2 RHEL 6.9 App2 RHEL 6.9 App2 RHEL 6.9 App2 RHEL 6.9 App2 @barkerd427
  5. 5. Docker - the early ● Docker is an abstraction ○ cgroups ○ Namespaces @barkerd427 ● Not Included ○ Metadata ○ Volumes ○ Secrets ○ Services ○ Network
  6. 6. Docker - the latter ● Volumes ● Secrets ● Networks @barkerd427 ● Plugins ● Services ● Labels
  7. 7. https://devopscube.com
  8. 8. http://isagoksu.com/
  9. 9. Kubernetes (k8s) ● Secrets ● PersistentVolumes ● Services ● Pods @barkerd427 ● Ingress ● DaemonSets ● ReplicaSets ● Deployments
  10. 10. Kubernetes Architecture https://www.slideshare.net/erialc_w/kubernetes-50626679
  11. 11. OpenShift ● Routes > Ingress ● DeploymentConfig > Deployments @barkerd427 ● ImageStream ● BuildConfig
  12. 12. http://blog. openshift. com
  13. 13. Security Linux Kernel Capabilities ● Specific privs ● Restricted defaults ● Not granular enough ● Still an improvement Seccomp Security Profiles ● Syscall granularity ● Sane defaults ● Least privilege ● Big improvement @barkerd427
  14. 14. Services will change your life @barkerd427
  15. 15. Services ● Identifies pods using label selectors ○ Any label ○ Specific to avoid errant selections ● Passes requests to pods internally ○ Routes and Services are different ● Abstraction for a Route to pass traffic @barkerd427
  16. 16. Services http://blog.openshift.com
  17. 17. One Route, One Service, One Application Route Service Pod @barkerd427
  18. 18. The Route directs to the Service application0 ➜ ~ oc export routes application0 apiVersion: v1 kind: Route [...] spec: host: application0-presentation... to: kind: Service name: application0 weight: 100 [...] @barkerd427
  19. 19. The Service matches on the label “deploymentconfig” with the value “application0”. ➜ ~ oc export svc application0 apiVersion: v1 kind: Service spec: selector: deploymentconfig: application0 @barkerd427
  20. 20. The Pod has many labels. ➜ ~ oc export -o yaml po/application0-1-ao16l apiVersion: v1 kind: Pod metadata: labels: app: application0 deploymentconfig: application0 environment: dev partition: customerA release: stable tier: frontend [...] @barkerd427
  21. 21. The Service now matches on the label “tier” with the value “frontend”. ➜ ~ oc export svc application0 apiVersion: v1 kind: Service spec: selector: tier: frontend @barkerd427
  22. 22. One Route, One Service, Two Applications Route Application Application Service Service @barkerd427
  23. 23. Curling the same Route results in two different applications responding. @barkerd427
  24. 24. The Pod has many labels. ➜ ~ oc export -o yaml po/application0-beta-1-ao16l apiVersion: v1 kind: Pod metadata: labels: app: application0-beta deploymentconfig: application0-beta environment: dev partition: customerA release: stable tier: frontend [...] @barkerd427
  25. 25. We’ve deleted application1 and added application0-beta. @barkerd427
  26. 26. ImageStreams are an image abstraction @barkerd427
  27. 27. ImageStreams ● Contains images from: ○ Integrated registry ○ Other ImageStreams ○ External registries ● Automatic event triggers http://blog.openshift.com @barkerd427
  28. 28. ImageStreams - Metadata ● Commands ● Entrypoint ● EnvVars @barkerd427 ● Layers ● Labels ● Ports
  29. 29. http://blog.openshift.com ImageStreams
  30. 30. CoreOS Operators are magical (not really) @barkerd427
  31. 31. Not this
  32. 32. This
  33. 33. Operators ● Represents human operational knowledge in software ● Uses 3rd-party resources ○ Controller of controllers and resources @barkerd427 ● Identical model to k8s controllers ○ OODA Loop ● Not supported in OpenShift
  34. 34. Operators ● Deployed into k8s cluster ● Interactions through new controller ○ kubectl get prometheuses ○ kubectl get alertmanagers @barkerd427 ● Abstraction around k8s primitives ○ Users just want to use a MySQL cluster. ● Complex tasks that can be performed ○ Rotating credentials, certs, versions, backups
  35. 35. Deployment Pipeline’s have fallen behind @barkerd427
  36. 36. Pipelines ● Stages ● Steps ● Application @barkerd427 ● PipelineTemplate ● PipelineConfig
  37. 37. An Application includes a Pipeline, based on an opinionated PipelineTemplate. These combine as a PipelineConfig. apiVersion: v1 kind: Application name: app1 cap: template: name: approvedTemplates/Tomcat8.yaml pipeline: notifications: mattermost: team: cloud channel: general on_success: never on_failure: always dependencies: - name: authn dnsName: authn - name: key-management username: reference_to_username password: reference_to_password stages: - name: build steps: - action: build baseImage: version: 8.0.41 - name: dev approvers: - role: app1-dev steps: - action: deploy params: environment: dev apiVersion: v1 kind: PipelineTemplate name: Tomcat8 labels: type: application build: manager: maven version: latest builderImage: java8-builder version: latest baseImage: tomcat8 version: latest deploy: deploymentType: canary maxUnavailable: 10% maxSurge: 20% apiVersion: v1 kind: PipelineConfig name: app1-pipeline labels: type: application pipeline: notifications: mattermost: team: cloud channel: general on_success: never on_failure: always dependencies: - name: authn dnsName: authn - name: key-management username: reference_to_username password: reference_to_password stages: - name: build steps: - action: build manager: maven builderImage: java8-builder baseImage: tomcat8 version: 8.0.41 - name: dev approvers: - role: app1-dev steps: - action: deploy params: environment: dev @barkerd427
  38. 38. An Application and PipelineTemplate also combine to create a DeploymentConfig. apiVersion: v1 kind: Application name: app1 cap: template: name: approvedTemplates/Tomcat8.yaml pipeline: notifications: mattermost: team: cloud channel: general on_success: never on_failure: always dependencies: - name: authn dnsName: authn - name: key-management username: reference_to_username password: reference_to_password stages: - name: build steps: - action: build baseImage: version: 8.0.41 - name: dev approvers: - role: app1-dev steps: - action: deploy params: environment: dev apiVersion: v1 kind: PipelineTemplate name: Tomcat8 labels: type: application build: manager: maven version: latest builderImage: java8-builder version: latest baseImage: tomcat8 version: latest deploy: deploymentType: canary maxUnavailable: 10% maxSurge: 20% apiVersion: v1 kind: DeploymentConfig metadata: name: app1-pipeline type: application spec: replicas: 2 selector: name: frontend template: { ... } triggers: - type: ConfigChange - imageChangeParams: automatic: true containerNames: - helloworld from: kind: ImageStreamTag name: hello-openshift:latest type: ImageChange strategy: type: Rolling @barkerd427
  39. 39. The value of Pipelines ● Abstract audit and compliance ○ Approvals added dynamically ● Trivialities eliminated ○ Tabs vs. spaces ○ Semicolons or not ● Security checks occur early and often ○ Feedback is important @barkerd427
  40. 40. The value of Pipelines ● Test all the things! ● Nimble security ● Common artifact repositories ○ Restrict dependencies ○ Automated security vulnerability notification ● Standardized/Centralized approval system ● Applications will become secure by default @barkerd427
  41. 41. Thanks! Contact me: Dan Barker drbarker@dstsystems.com dan@danbarker.codes danbarker.codes @barkerd427
  42. 42. Help us get better! my talk http://bit.ly/BSidesKCTal kEval the conference http://bit.ly/BSidesKCEv entEval anything else http://bit.ly/IqT6zt Please provide feedback on…

×