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

Skaffold for Java: Continuous Development for Kubernetes

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).

Q Chen

October 22, 2018
Tweet

More Decks by Q Chen

Other Decks in Programming

Transcript

  1. 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
  2. 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
  3. 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
  4. code build push Development Process deploy application connect k8s config

    update Things I care about Things I wish would just happen
  5. 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
  6. Jib

  7. 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-*
  8. 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)
  9. 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
  10. Other features - skaffold run - skaffold build - remote

    file sync - --trigger=manual Future features - Debugger - Test phase - IDE support - skaffold init with Jib - Beta