Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Ray Tsang on Tools and Best Practices for Kubernetes Adoption

Ray Tsang on Tools and Best Practices for Kubernetes Adoption

Leia em Português

Ray Tsang, developer advocate at Google, spoke last week at SpringOne Platform 2019 Conference about the tools and best practices developers can use in Kubernetes adoption in their organizations.

Containerization and adopting container platforms like Kubernetes has been a challenge for application developers. Building container images involves Dockerfiles, which are cumbersome and error-prone to create and maintain in the long run. Also, IDE tooling support for developing and maintaining container based applications has been poor. This typically slows down the entire software development cycle.

The Spring Cloud Kubernetes project provides common interfaces that consume Kubernetes native services. The main objective of the project is to help with the integration of Spring Cloud and Spring Boot applications running inside Kubernetes.

Tsang talked about TestContainers, which is a Java library that supports JUnit tests with disposable instances of common databases, Selenium web browsers, or other servers that can run in a Docker container. TestContainers make it easier to run tests in the data access layer, application integration tests and the UI tests. You can test most of the components in your container based application locally on the laptop.

He also talked about the importance of understanding the memory usage in Java applications to avoid OOMKilled situations. Tools like Cloud Foundry Java Build Pack Memory Calculator can be used to calculate a holistic JVM memory configuration to ensure the applications perform well without exceeding the container's memory limit and being recycled.

Tsang mentioned the container best practices presentation where he discussed a series of techniques for creating and managing Docker containers. One tip included not running the container as the root user. Most of the images run as root, but the developers should change this setting to restrict the privileges. He also explained how to make sure the containers images don't take up too much space, and how to avoid the containers from running out of space.

Other tools that can help with Kubernetes adoption include Jib and Skaffold for fast image build and development cycle turnaround time.

Jib builds optimized Docker and Open Container Initiative (OCI) images for Java applications without the need to run a Docker daemon. It creates a Dockerfile automatically, and works even if you don't have Docker installed locally. Jib is available as a plugin for Maven and Gradle and also as a Java library.

Skaffold is a command line tool from Google that facilitates continuous development for Kubernetes applications. It can be used for all the workflow steps in building, pushing and deploying the application. Skaffold also provides building blocks and customizations for a CI/CD pipeline.

Tsang also discussed other best practices for configuring Java applications to run inside of Kubernetes, such as health checks, zero downtime deployment, externalizing configurations, and logging.

Rate this Article