1

Deploy Kotlin Applications to Kubernetes without Dockerfiles

Deploy Ktor applications instantly to Kubernetes without Dockerfiles.
Deploy Ktor applications instantly to Kubernetes without Dockerfiles.

This is a follow up blog post of my earlier post Continuous Delivery to Kubernetes with jib, skaffold and ktor. The sample source code repository remains the same: https://github.com/lotharschulz/ktorjib.

Use Case

The main use case also remains the same:
Whenever source code changes, skaffold applies the changes to the Kubernetes cluster almost instantly.

Why a follow up post?
I prepared a talk and there a updates available for some technologies used:

Update considerations

Kotlin

Updating Kotlin was rather easy: just define the kotlin version in the gradle build script.

Java & Jib

Update to Java 12, in more detail to

java.sourceCompatibility = JavaVersion.VERSION_12

Changing the java version as above requires a Java12 Jib Gradle plugin base image :

    from { image = "openjdk:12" }

The Jib default base image contains OpenJDK 8 (gcr.io/distroless/java:8) or 11 (gcr.io/distroless/java:11) and its dependencies out of the box, so Java 11 support would not require a specific base image as shown above. Based on jib#2015 that is listed in the upcoming version changelog I assume Jib Java 13/14 support is eventually coming,

Skaffold & Jib

The skaffold binary update caused a _skaffoldFailIfJibOutOfDate issue. Updating jib resolved that issue.

Ktor & Netty

After I updated the ktor version, I experienced a NativeLibraryLoader error similar to ktor#1203. I followed this workaround and created a logback descriptor to suppress the error message.


Deploy Ktor applications instantly to Kubernetes without Dockerfiles.
Deploy Ktor applications instantly to Kubernetes without Dockerfiles.

Screen cast

  • skaffold dev
    in the left pane – skaffold watching for code changes and applying those
  • ./web.sh
    in the upper right pane – the script checks the service endpoint for code changes becoming effective. The script assumes kubernetes runs on (minikube)[link auf zeile ip=$(minikube ip) ] and the web kubernetes service is already deployed.
  • changing code in the lower right pane

screen cast Auto Deploy Kotlin Applications to Kubernetes w/o Dockerfiles

Slides

Further reading

Lothar Schulz

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.