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

Skaffold for Java: Continuous Development for Kubernetes

57007fa9a005a5dfb163141c67d46c36?s=47 Q Chen
October 22, 2018

Skaffold for Java: Continuous Development for Kubernetes

Originally presented at Oracle Code One 2018.

Skaffold: https://github.com/GoogleContainerTools/skaffold
Jib: https://github.com/GoogleContainerTools/jib
Demo project: https://github.com/coollog/skaffold-code.one

Session Description:

Skaffold is a command-line tool that facilitates continuous development for Kubernetes applications. You can iterate on your application source code locally and then deploy to local or remote Kubernetes clusters. Skaffold handles the workflow for building, pushing, and deploying your application. This session explores developing a Java application with Skaffold. This session presents and demos Java development on Kubernetes orchestrated by Skaffold and integrated with standard Java building tooling (Maven/Gradle).

57007fa9a005a5dfb163141c67d46c36?s=128

Q Chen

October 22, 2018
Tweet

Transcript

  1. Continuous Development for Kubernetes Skaffold for Java github.com/GoogleContainerTools/skaffol d

  2. Skaffold github.com/GoogleContainerTools/skaffold

  3. Cloud Tools for Java Appu Goundan @loosebazooka Qingyang “Q” Chen

    @coollog
  4. Skaffold is a command line tool that facilitates continuous development

    for Kubernetes applications. You can iterate on your application source code locally then deploy to local or remote Kubernetes clusters. Skaffold handles the workflow for building, pushing and deploying your application. It can also be used in an automated context such as a CI/CD pipeline to leverage the same workflow and tooling when moving applications to production. github.com/GoogleContainerTools/skaffold official website
  5. "Dev"

  6. Build $ ./gradlew assemble

  7. Containerize $ ./gradlew assemble $ docker build . -t gcr.io/co-repo/co-app:v9

  8. Push $ ./gradlew assemble $ docker build . -t gcr.io/co-repo/co-app:v9

    $ docker push gcr.io/co-repo/co-app:v9
  9. Deploy $ ./gradlew assemble $ docker build . -t gcr.io/co-repo/co-app:v9

    $ docker push gcr.io/co-repo/co-app:v9 $ vi co-deployment.yaml $ kubectl apply -f co-deployment.yaml
  10. Connect $ ./gradlew assemble $ docker build . -t gcr.io/co-repo/co-app:v9

    $ docker push gcr.io/co-repo/co-app:v9 $ vi co-deployment.yaml $ kubectl apply -f co-deployment.yaml $ kubectl get pods $ kubectl port-forward co-pod-qx54dw 8080:8080 $ kubectl logs -f co-pod-qx54dw
  11. None
  12. code build push Development Process deploy application connect k8s config

    update Things I care about Things I wish would just happen
  13. Skaffold $ skaffold dev

  14. skaffold code Development Process application k8s config

  15. Demo

  16. Skaffold Workflow

  17. apiVersion: skaffold/v1alpha4 kind: Config build: artifacts: - image: gcr.io/appu-learn/skaffold-talk context:

    app deploy: kubectl: manifests: - k8s-* Simple Skaffold Config kind: Deployment ... spec: template: spec: containers: - image: gcr.io/appu-learn/skaffold-talk ports: - containerPort: 8080 skaffold.yaml k8s-deployment.yaml
  18. Pluggable

  19. None
  20. None
  21. None
  22. Demo

  23. What about Java? What about Jib?

  24. github.com/GoogleContainerTools/jib 1. Apply the plugin. 1. Apply the plugin. 2.

    gradle jib Steps: (or mvn jib:build)
  25. Jib ❤ Skaffold

  26. Jib

  27. apiVersion: skaffold/v1alpha4 kind: Config build: artifacts: - imageName: gcr.io/appu-learn/skaffold-talk jibGradle:

    {} deploy: kubectl: manifests: - k8s-* Simple skaffold.yaml (powered up with Jib) apiVersion: skaffold/v1alpha4 kind: Config build: artifacts: - imageName: gcr.io/appu-learn/skaffold-talk jibMaven: {} deploy: kubectl: manifests: - k8s-*
  28. apiVersion: skaffold/v1alpha4 kind: Config build: artifacts: - imageName: gcr.io/appu-learn/skaffold-talk jibGradle:

    project: subproject deploy: kubectl: manifests: - k8s-* apiVersion: skaffold/v1alpha4 kind: Config build: artifacts: - imageName: gcr.io/appu-learn/skaffold-talk jibMaven: profile: skaffold module: submodule deploy: kubectl: manifests: - k8s-* Simple skaffold.yaml (powered up with Jib)
  29. Lets see this in action!

  30. Survey App frontend-service Groovy/Micronaut/Gradle / cast votes vote-service Java/Spring/Gradle /results

    view results notification-service NodeJS
  31. apiVersion: skaffold/v1alpha4 kind: Config build: artifacts: - image: gcr.io/qingyangc-sandbox/codeone-frontend jibGradle:

    {} context: frontend-service - image: gcr.io/qingyangc-sandbox/codeone-vote jibGradle: {} context: vote-service - image: gcr.io/qingyangc-sandbox/codeone-notification context: notification-service skaffold.yaml
  32. skaffold dev github.com/coollog/skaffold-code.one

  33. skaffold-code.one github.com/coollog/skaffold-code.one

  34. Other features - skaffold run - skaffold build - remote

    file sync - --trigger=manual Future features - Debugger - Test phase - IDE support - skaffold init with Jib - Beta
  35. github.com/GoogleContainerTools/skaffold github.com/GoogleContainerTools/jib github.com/coollog/skaffold-code.one