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 863MB to just 22.3MB.
  • Lowered deployment time significantly, from 67.506 seconds to 14.515 seconds.
  • Achieved ~58x 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.