yblaz - Fotolia

Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Kubernetes deployments vs. pods: What's the difference?

Pods and deployments are both important to using Kubernetes in production, but they're not the same. Learn the role each one plays in building and managing containerized applications.

Pods and deployments are foundational components for any large-scale Kubernetes environment, but they serve different purposes. You need to understand the role each one plays if you want to use Kubernetes in production.

Kubernetes deployments vs. pods

In short, a pod is the core building block for running applications in a Kubernetes cluster; a deployment is a management tool used to control the way pods behave. Let's take a closer look at when and where to use pods and deployments.

What is a pod?

In Kubernetes, a pod is either a single container or a group of related containers that share storage and networking resources.

Pods are the smallest application building blocks within a Kubernetes cluster. A pod could host an entire application, or it could host part of one.

A developer or administrator creates the pod or pods necessary to run an application, and Kubernetes automatically manages them. Kubernetes decides which nodes -- or servers -- within the cluster should host each pod, and it automatically restarts pods if they fail.

By default, Kubernetes runs one instance of each pod you create. If desired, however, you can create multiple instances of the same pod using ReplicaSets, which are defined via a deployment.

What is a deployment?

Deployment is a specialized term in the context of Kubernetes. It doesn't necessarily refer to the deployment of applications or services. Rather, a deployment is a file that defines a pod's desired behavior or characteristics.

Administrators use deployments to specify what they want to happen with their applications. Then, Kubernetes automatically performs the steps necessary to create the specified state.

For example, a deployment file can define the number of copies -- or replicas, as they're known in Kubernetes -- of a given pod. Or, a deployment can upgrade an existing pod to a new application version by updating the base container image.

By using Kubernetes to operationalize defined behavior, admins don't have to perform all the steps required to achieve a desired state. They can apply a change or update across the entire cluster with one short policy file, which saves time and increases the scalability of Kubernetes clusters.

For instance, instead of manually upgrading the container image version in a pod, you can use a deployment to tell Kubernetes to do it automatically with a single file and command.

Dig Deeper on Managing Virtual Containers