Containers
Container and Kubernetes best practices
Best Practices
CNCF Cloud-Native Definition & Principles
The CNCF’s formal definition of cloud-native computing and core principles for micro-services, containers, and dynamic orchestration.
by Cloud Native Computing FoundationKubernetes Pod Security Standards
Baseline, restricted, and privileged policy levels for securing pod workloads.
by Kubernetes SIG AuthCNCF Cloud-Native Security Whitepaper
Guidance on building, shipping, and running secure cloud-native applications.
by CNCF Security TAGHelm Chart Best Practices
Recommendations for structure, naming, versioning, and values of Helm charts.
by Helm MaintainersContainer Image Hardening Guide
Steps to build minimal, non-root, signed container images with SBOMs.
by CIS & DockerSidecar Pattern
A design pattern that deploys a helper component alongside the main application in the same unit, adding capabilities like proxying, logging, or config without changing the app.
by MicrosoftTutorials
How to build and optimize Docker images for smaller, faster builds
Reduce Docker image size and build time with layer ordering, .dockerignore, and build cache strategies.
How to use multi-stage Docker builds to shrink production images
Separate build and runtime stages so compilers and dev dependencies stay out of the final image.
How to build distroless container images for minimal attack surface
Run applications on distroless base images that contain no shell or package manager, reducing size and CVEs.
How to run a multi-container app with Docker Compose
Define an app, a database, and a cache as services in one Compose file with networks, volumes, and health checks.
How to deploy an application to Kubernetes with Deployment and Service
Package an image into a Kubernetes Deployment and expose it with a Service, then scale and roll out updates.
How to configure liveness, readiness, and startup probes in Kubernetes
Add health probes so Kubernetes restarts unhealthy pods and only routes traffic to ready ones.
How to autoscale pods with the Kubernetes HorizontalPodAutoscaler
Scale a Deployment automatically on CPU or custom metrics using the HorizontalPodAutoscaler and metrics-server.
How to expose Kubernetes services with an Ingress and TLS
Route external HTTP traffic to services using an Ingress controller, host and path rules, and automatic TLS.
How to manage configuration with Kubernetes ConfigMaps and Secrets
Externalize app settings into ConfigMaps and sensitive values into Secrets, mounted as env vars or files.
How to run stateful workloads with a Kubernetes StatefulSet
Deploy databases and other stateful apps with stable network identities and per-pod persistent storage.
How to build and run rootless containers
Run containers as a non-root user with Podman or Docker rootless mode to reduce privilege and risk.
How to set Kubernetes resource requests and limits correctly
Right-size CPU and memory requests and limits to improve scheduling, stability, and Quality of Service.
Checklists
Kubernetes Production Readiness Checklist
Confirm a Kubernetes cluster and its workloads are secure, observable, and resilient before serving production traffic.
Container Security Hardening Checklist
Harden container images, build pipelines, and runtime so containerized workloads resist compromise and supply-chain attacks.
Kubernetes Cluster Setup Checklist
Provision a new managed Kubernetes cluster with the networking, security, and platform add-ons teams need from day one.
Technology Stacks
AWS ECS Fargate Containers Stack
Managed container stack running Docker workloads on AWS ECS with Fargate serverless compute, behind a load balancer, without managing servers or clusters.
FAQs
What is a container?
A container is a lightweight, standalone unit that packages an application together with its dependencies, libraries, and configuration so it runs consistently across environments. Containers share the host operating system kernel and isolate processes using OS features such as namespaces and cgroups, which makes them far smaller and faster to start than virtual machines. They are the standard way to build, ship, and run cloud-native applications. Docker popularized the format, and the Open Container Initiative (OCI) now defines the image and runtime standards.
What is the difference between a Docker container and a virtual machine?
A virtual machine (VM) virtualizes hardware and runs a full guest operating system on top of a hypervisor, so each VM carries its own kernel and is heavy in size and boot time. A container virtualizes the operating system instead, sharing the host kernel and isolating only the application and its dependencies, which makes it megabytes rather than gigabytes and starts in seconds. VMs offer stronger isolation and can run different operating systems, while containers offer higher density and faster deployment. Many production systems combine both, running containers inside VMs for layered isolation.
What is Kubernetes?
Kubernetes is an open-source platform for automating the deployment, scaling, and operation of containerized applications. It groups containers into logical units, schedules them across a cluster of machines, restarts failed workloads, and rolls out updates without downtime. Originally developed at Google and now governed by the Cloud Native Computing Foundation (CNCF), it has become the de facto standard for container orchestration. Users describe the desired state in declarative manifests, and Kubernetes continuously reconciles the actual state to match it.
What is the difference between a Kubernetes pod and a container?
A container is a single packaged process, while a pod is the smallest deployable unit in Kubernetes and can hold one or more containers that share the same network namespace and storage volumes. Containers in a pod are always scheduled together on the same node and can communicate over localhost. Most pods run a single primary container, but a pod may include helper containers such as sidecars or init containers. Kubernetes manages pods, not individual containers, when scaling and scheduling.
When should I use Kubernetes?
Kubernetes makes sense when you run many containerized services that need automated scaling, self-healing, rolling updates, and consistent deployment across environments. It is a strong fit for microservice architectures, multi-team platforms, and workloads with variable load. For a single small application or a simple website, Kubernetes often adds unnecessary operational complexity, and a managed container service, platform-as-a-service, or serverless option may be simpler. The decision should weigh the operational cost of running Kubernetes against the scale and flexibility you actually need.
What is a Kubernetes ingress controller?
An ingress controller is a component that implements Kubernetes Ingress resources, routing external HTTP and HTTPS traffic to services inside the cluster based on rules such as hostnames and URL paths. The Ingress object defines the routing rules, but a controller, such as NGINX, Traefik, or a cloud load-balancer integration, must be installed to enforce them. Ingress controllers commonly handle TLS termination, name-based virtual hosting, and path-based routing. They provide a single, centralized entry point instead of exposing each service separately.
What is a container image?
A container image is a read-only template that contains everything needed to run an application: code, runtime, libraries, environment variables, and configuration. Images are built in layers, where each instruction adds a layer that can be cached and shared, making builds and distribution efficient. When you run an image, the container engine adds a writable layer on top to create a running container. Images follow the Open Container Initiative (OCI) standard and are stored in registries such as Docker Hub or a private registry.
What is a container registry?
A container registry is a storage and distribution system for container images, allowing them to be pushed after a build and pulled at deployment time. Public registries such as Docker Hub host shared images, while private registries such as Amazon ECR, Google Artifact Registry, Azure Container Registry, and Harbor host an organization's own images. Registries support versioning through tags and digests and often add features like vulnerability scanning, access control, and image signing. They are a core part of any container delivery pipeline.
What is container orchestration?
Container orchestration is the automated management of the lifecycle of containers across a cluster of machines, including scheduling, scaling, networking, load balancing, and self-healing. As the number of containers grows, manual management becomes impractical, and an orchestrator handles placement, restarts failed containers, and rolls out updates safely. Kubernetes is the dominant orchestrator, with alternatives such as Docker Swarm, HashiCorp Nomad, and managed services like Amazon ECS. Orchestration is what makes large-scale containerized systems operable and reliable.
What is a Kubernetes namespace?
A namespace is a way to divide a single Kubernetes cluster into multiple virtual clusters, providing a scope for names and a boundary for resources. Namespaces let teams or environments such as development, staging, and production share one cluster while keeping their objects logically separated. They enable resource quotas, access control through role-based policies, and network policies to be applied per group. Namespaces provide logical isolation but not strong security isolation between workloads on their own.
What is a Kubernetes service?
A Kubernetes Service is an abstraction that gives a stable network identity and address to a dynamic set of pods, since pods are ephemeral and their IP addresses change. It load-balances traffic across the matching pods using label selectors, so clients connect to the service rather than to individual pods. Common types are ClusterIP for internal access, NodePort and LoadBalancer for external access, and ExternalName for mapping to an external host. Services are how reliable communication between components is achieved inside a cluster.
Benchmarks
Container Startup Time Benchmark
Measures how quickly a container goes from launch to ready, covering image pull, runtime creation, and application readiness for scaling and resilience.