Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

@drnic To Infinity! Let's Build a Buildpack More of me (Dr Nic) 2pm Office Hours: Buildpacks Buildpack Core Team 11am TOMORROW

Slide 3

Slide 3 text

@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

Slide 4

Slide 4 text

@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

Slide 5

Slide 5 text

@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

Slide 6

Slide 6 text

@d @drnic Actual Universe Dev team

Slide 7

Slide 7 text

@d @drnic Actual Universe Dev team

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

@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

Slide 10

Slide 10 text

Cloud Native Buildpacks Pivotal & Heroku initiative CNCF incubation

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Buildpacks Lifecycle Builder OCI/Docker image

Slide 13

Slide 13 text

Separation of Concerns Operating System updates to existing OCIs

Slide 14

Slide 14 text

@d @drnic Today Introduce kpack Build images atop Kubernetes Introduce pack CLI Build images locally, deploy to Kube kP

Slide 15

Slide 15 text

@d @drnic Quick Demo docker run -p 8080 NodeJS app pack build Ɲ Run in a kubernetes pod Inside container to see folders

Slide 16

Slide 16 text

@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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

@d @drnic Deployment $ pack build \ starkandwayne/sample-app-nodejs:0.0.1 \ --publish $ kubectl apply -f deployment.yaml $ kubectl get pods,services $ watch curl :8080 $ pack build …:0.0.2 --publish edit deployment.yml $ kubectl apply -f deployment.yaml

Slide 19

Slide 19 text

@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

Slide 20

Slide 20 text

@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

Slide 21

Slide 21 text

@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

Slide 22

Slide 22 text

@d @drnic kpack image kP pack build starkandwayne/sample-app-nodejs --builder cloudfoundry/cnb:cflinufs3 \ --path sample-app-nodejs/ \ --publish Similar to:

Slide 23

Slide 23 text

@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

Slide 24

Slide 24 text

@d @drnic Deployment # edit deployment.yaml image ref $ kubectl apply -f deployment.yaml $ kubectl get all $ watch curl -sS 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

Slide 25

Slide 25 text

@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

Slide 26

Slide 26 text

Buildpacks Lifecycle Builder OCI/Docker image pack or kpack or (soon) cloud foundry

Slide 27

Slide 27 text

@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

Slide 28

Slide 28 text

@d @drnic Avoid Don't go straight to Dockerfiles

Slide 29

Slide 29 text

@drnic To Infinity! Let's Build a Buildpack More of me (Dr Nic) 2pm Office Hours: Buildpacks Buildpack Core Team 11am TOMORROW