Skip to content

electrocucaracha/k8s-Distroless-demo

Repository files navigation

Measuring the Benefits of Distroless Containers

License GitHub Super-Linter Ruby Style Guide

visitors Scc Code Badge Scc COCOMO Badge

Summary

This demo project highlights the advantages of using Distroless containers by evaluating key metrics such as image size, deployment time, and data transfer efficiency.

Objectives

  • Image Size Reduction: Compare the size of a standard container image with a Distroless version.
  • Deployment Time Improvement: Measure the deployment time reduction achieved by using Distroless containers.
  • Data Transfer Efficiency: Analyze the impact on network usage and costs when deploying to cloud environments.

Methodology

  1. Initial Setup: Provision a Kubernetes cluster connected to a private Docker registry and create a standard container image, including build tools and a generic JRE.
  2. Implementation of Best Practices: Utilize Multi-stage builds and Distroless best practices, along with tools like jdeps and jlink fro JRE optimization.
  3. Measurement: Record metrics for image size, deployment time, and network usage during deployment to Kubernetes worker nodes.

Outcomes

  • Successfully reduced image size from 842MB to just 39.5MB.
  • Lowered deployment time significantly, from 44.78 seconds to 10.38 seconds.
  • Achieved +23x reduction in data transfer from the private local registry to the seven Kubernetes worker nodes.

Using Distroless images can lead to monthly cost savings and minimize traffic congestion.