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

Bringing Buildpacks to Kubernetes

Bringing Buildpacks to Kubernetes

Kubernetes solves orchestration of containers, but it does not solve the 10 year problem of ensuring that the software running in production always contains CVEs to the root filesystem, to OS packages, to language packages, and the application itself.

Replace Dockerfiles with Cloud Native Buildpacks to convert your application software into OCI/docker images, and use tools like pack and kpack to continuously upgrade images with latest dependencies, and to rebase the base OS layer of images to latest version.

Dr Nic Williams

September 11, 2019
Tweet

More Decks by Dr Nic Williams

Other Decks in Technology

Transcript

  1. Title Text Body Level One Body Level Two Body Level

    Three Body Level Four Body Level Five Bringing Buildpacks to Kubernetes Cloud Foundry Summit Hague 2019 Dr Nic Williams @drnic
  2. @drnic To Infinity! Let's Build a Buildpack More of me

    (Dr Nic) 2pm Office Hours: Buildpacks Buildpack Core Team 11am TOMORROW
  3. @d @drnic Problem Scope ? Consider every app over 10

    years Real world problem changes Programming language changes Dependency changes Several major OS version changes Perhaps one wholesale OS change Deployment platform changes CI/CD changes Original dev team disbanded CVEs are everywhere
  4. @d @drnic Ideal Universe Separation of concerns Dev team Real

    world problem changes Language-specific team Programming language changes Dependency changes Platform team Several major OS version changes Perhaps one wholesale OS change Deployment platform changes CI/CD changes
  5. @d @drnic Possible Universe Dev team Real world problem changes

    Programming language changes Dependency changes Language-specific team Supported versions Runtime configuration Platform team CI/CD changes Several major OS version changes Perhaps one wholesale OS change Deployment platform changes
  6. @d @drnic Choose
 your
 Problem Statement ? How to package

    our app once?
 Solution: Dockerfile Operate/upgrade app for 10 yr? Solution: Not with a Dockerfile or
  7. @d @drnic Today Introduce kpack Build images atop Kubernetes Introduce

    pack CLI Build images locally, deploy to Kube kP
  8. @d @drnic Quick Demo docker run -p 8080 NodeJS app

    pack build Ɲ Run in a kubernetes pod Inside container to see folders
  9. @d @drnic Quick Demo $ pack set-default-builder \ cloudfoundry/cnb:cflinuxfs3 $

    pack build starkandwayne/sample-app-nodejs [detector] ======== Results ======== [detector] pass: Node Engine Buildpack [detector] pass: Yarn Buildpack … [builder] -----> Node Engine Buildpack 0.0.26 [builder] Node Engine 10.16.2: [builder] Downloading from … $ docker run -ti -p 8080:8080 \ starkandwayne/sample-app-nodejs
  10. Example Spring $ pack build starkandwayne/sample-app-java ===> DETECTING [detector] skip:

    [email protected] [detector] pass: [email protected] [detector] pass: [email protected] [detector] pass: [email protected] [detector] pass: [email protected] [detector] pass: [email protected] [detector] skip: [email protected] [detector] skip: [email protected] [detector] Resolving plan... (try #1) [detector] Success! (7) … [builder] Cloud Foundry OpenJDK Buildpack 1.0.0-RC02 [builder] OpenJDK JDK 11.0.4: Contributing to layer $ docker run -ti -p 8080:8080 \ starkandwayne/sample-app-java
  11. @d @drnic Deployment $ pack build \ starkandwayne/sample-app-nodejs:0.0.1 \ --publish

    $ kubectl apply -f deployment.yaml $ kubectl get pods,services $ watch curl <LB>:8080 $ pack build …:0.0.2 --publish edit deployment.yml $ kubectl apply -f deployment.yaml
  12. @d @drnic yarn v npm $ yarn install $ pack

    build starkandwayne/sample-app-nodejs [detector] ======== Results ======== [detector] pass: Node Engine Buildpack [detector] pass: Yarn Buildpack … [builder] Process types: [builder] web: yarn start $ docker run -ti -p 8080:8080 \ starkandwayne/sample-app-nodejs
  13. @d @drnic yarn v npm $ rm yarn.lock $ npm

    install $ pack build starkandwayne/sample-app-nodejs [detector] ======== Results ======== [detector] pass: Node Engine Buildpack [detector] pass: NPM Buildpack … [builder] Process types: [builder] web: npm start $ docker run -ti -p 8080:8080 \ starkandwayne/sample-app-nodejs
  14. @d @drnic kpack kP configure via kube resources buildpack lifecycle

    as a service runs in kubernetes Ɲ push images to any registry kpack or similar will come to CF
  15. @d @drnic Quick Demo $ kubectl apply -f serviceaccount.yaml $

    kubectl apply -f builder-cflinuxfs3.yaml $ git clone …/sample-app-nodejs.git $ kubectl apply -f kpack-image.yaml $ logs -image sample-app-nodejs … $ kubectl get image sample-app-nodejs starkandwayne/sample-app-nodejs@sha256:dbcf56 kP https://github.com/starkandwayne/sample-app-nodejs.git
  16. @d @drnic Deployment # edit deployment.yaml image ref $ kubectl

    apply -f deployment.yaml $ kubectl get all $ watch curl -sS <LB> Hello World! # commit change to app; wait for new image $ kubectl get builds -w $ logs -image sample-app-nodejs # edit deployment.yaml image ref $ kubectl apply -f deployment.yaml $ kubectl get pods -w Hello CF Summit! kP https://github.com/starkandwayne/sample-app-nodejs.git
  17. @d @drnic Built with pack $ ./hack/release.sh … similar to…

    pack build gcr.io/kpack/controller ./cmd/controller pack build gcr.io/kpack/build-init ./cmd/build-init pack build gcr.io/kpack/source-init ./cmd/source-init …creates release.yaml kP https://github.com/pivotal/kpack
  18. @d @drnic Possible Universe Dev team Real world problem changes

    Programming language changes Dependency changes Language-specific team Supported versions Runtime configuration Platform team CI/CD changes Major OS version changes One wholesale OS change Deployment platform changes App Buildpacks Builders Base OS Run Image CF platform
  19. @drnic To Infinity! Let's Build a Buildpack More of me

    (Dr Nic) 2pm Office Hours: Buildpacks Buildpack Core Team 11am TOMORROW