What is a Kubernetes deployment? (2024)

  • Topics
  • Understanding Linux containers
  • What is a Kubernetes deployment?

Published April 23, 2020

What is a Kubernetes deployment? (1)

Red Hat named a Leader in the 2023 Gartner® Magic Quadrant™

Red Hat was positioned highest for ability to execute and furthest for completeness of vision in the Gartner 2023 Magic Quadrant for Container Management.

Read the report

Overview

A Kubernetes deployment is a resource object in Kubernetes that provides declarative updates to applications. A deployment allows you to describe an application’s life cycle, such as which images to use for the app, the number of pods there should be, and the way in which they should be updated.

A Kubernetes object is a way to tell the Kubernetes system how you want your cluster’s workload to look. After an object has been created, the cluster works to ensure that the object exists, maintaining the desired state of your Kubernetes cluster.

The process of manually updating containerized applications can be time consuming and tedious. Upgrading a service to the next version requires starting the new version of the pod, stopping the old version of a pod, waiting and verifying that the new version has launched successfully, and sometimes rolling it all back to a previous version in the case of failure.

Performing these steps manually can lead to human errors, and scripting properly can require a significant amount of effort, both of which can turn the release process into a bottleneck.

A Kubernetes deployment makes this process automated and repeatable. Deployments are entirely managed by the Kubernetes backend, and the whole update process is performed on the server side without client interaction.

A deployment ensures the desired number of pods are running and available at all times. The update process is also wholly recorded, and versioned with options to pause, continue, and roll back to previous versions.

Automate deployments with pre-made, repeatable Kubernetes patterns

The Kubernetes deployment object lets you:

  • Deploy a replica set or pod
  • Update pods and replica sets
  • Rollback to previous deployment versions
  • Scale a deployment
  • Pause or continue a deployment

Application management strategies using Kubernetes deployment

Managing your applications with a Kubernetes deployment includes the way in which an application should be updated. A major benefit of a deployment is the ability to start and stop a set of pods predictably.

Rolling update strategy

A rolling update strategy provides a controlled, phased replacement of the application's pods, ensuring that there are always a minimum number available.

The deployment makes sure that, by default, a maximum of only 25% of pods are unavailable at any time, and it also won’t over provision more than 25% of the number of pods specified in the desired state.

The deployment won’t kill old pods until there are enough new pods available to maintain the availability threshold, and it won’t create new pods until enough old pods are removed.

The deployment object allows you to control the range of available and excess pods through maxSurge and maxUnavailable fields.

With a rolling update strategy there is no downtime during the update process, however the application must be architected to ensure that it can tolerate the pod destroy and create operations.

During the update process 2 versions of the container are running at the same time, which may cause issues for the service consumers.

Recreate strategy

A recreate strategy removes all existing pods before new ones are created. Kubernetes first terminates all containers from the current version and then starts all new containers simultaneously when the old containers are gone.

With a recreate deployment strategy there is some downtime while all containers with old versions are stopped and no new containers are ready to handle incoming requests.

However, there won’t be 2 versions of the containers running at the same time, which may make it simpler for service consumers.

Kubernetes with Red Hat OpenShift

Declarative deployment pattern for Kubernetes

Deployments are created by writing a manifest. The manifest is then applied to the Kubernetes cluster using kubectl apply, or you can use a declarative deployment pattern. Configuration files for Kubernetes can be written using YAML or JSON.

When creating a deployment, you’ll describe the desired state and Kubernetes will implement it using either a rolling or recreate deployment strategy.

Using a declarative deployment pattern allows you to use a Kubernetes deployment to automate the execution of upgrade and rollback processes for a group of pods. Kubernetes patterns are reusable design patterns for container-based applications and services.

You can update a deployment by making changes to the pod template specification. When a change is made to the specification field, it triggers an update rollout automatically.

The rollout lifecycle consists of progressing, complete, and failed states. A deployment is progressing while it is performing update tasks, such as updating or scaling pods.

Complete indicates that all tasks were completed successfully and the system is in the desired state. A failed state is the result of some error that keeps the deployment from completing its tasks.

You can check or monitor the state of a deployment using the kubectl rollout status command.

Need help getting started with Kubernetes? Learn to build and manage containers for deployment on a Kubernetes and Red Hat® OpenShift® cluster. This training course will help you to build core knowledge in managing containers through hands-on experience with containers and Kubernetes.

Start the training courseIcon-Red_Hat-Directional-A-Black-RGB

Kubernetes for the enterprise

Red Hat OpenShift is an enterprise-ready Kubernetes platform. It gives developers self-service environments for building, and full-stack automated operations on any infrastructure.

What is a Kubernetes deployment? (2)

Red Hat OpenShift includes all of the extra pieces of technology that makes Kubernetes powerful and viable for the enterprise, including: registry, networking, telemetry, security, automation, and services.

With Red Hat OpenShift, developers can make new containerized apps, host them, and deploy them in the cloud with the scalability, control, high availability, and orchestration that can turn a good idea into new business quickly and easily.

Learn more about Red Hat OpenShiftIcon-Red_Hat-Directional-A-Black-RGB

What is a Kubernetes deployment? (2024)

FAQs

What is a deployment in Kubernetes? ›

A Deployment manages a set of Pods to run an application workload, usually one that doesn't maintain state. A Deployment provides declarative updates for Pods and ReplicaSets. You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate.

What is the simplest way to deploy Kubernetes? ›

Prerequisites for Kubernetes Deployment
  1. STEP 1: Installing of Kubernetes on master and work nodes:
  2. STEP 2: Clone a repository.
  3. STEP 3: Building an image from Dockfile.
  4. STEP 4: Push the Docker image to a Registry.
  5. Login to the Docker hub.
  6. Push the image to register.
  7. Command - Line Interface:
  8. Yaml Manifest.
Apr 12, 2024

What is the best deployment strategy in Kubernetes? ›

  • Rolling Update Deployment. In Kubernetes deployment strategies, the Rolling Update strategy stands tall as a reliable and efficient approach to updating applications with minimal disruption. ...
  • Recreate Deployment. ...
  • Ramped Slow Rollout. ...
  • Best-effort Controlled Rollout.
Nov 18, 2023

What is the difference between Kubernetes deployment and pod? ›

Pods are responsible for hosting and managing the execution of your application's individual components. On the other hand, a Kubernetes Deployment defines a desired state for your application and manages the lifecycle of Pods.

When would you deploy Kubernetes? ›

The primary reason for using Kubernetes is to orchestrate containers in a containerized application. Containerization allows users to package applications into a single immutable and isolated container with all the dependencies that can be deployed virtually anywhere.

What is the basic unit of deployment Kubernetes? ›

Pods are the smallest deployable units of computing that you can create and manage in Kubernetes. A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.

What is the difference between service and deployment in Kubernetes? ›

Kubernetes Service and Deployment are two fundamental components of the Kubernetes ecosystem. While Service acts as the gateway for communication and load balancing, Deployment orchestrates the management and scaling of your application's replicas.

What tool to deploy K8s? ›

Rancher – Complete K8s cluster management

It is an open-source toolkit of cluster and container management tools that deliver Kubernetes-as-a-Service. Besides running containers in the cloud, on-premises (data center), and at the edge, Rancher is also ideal for hybrid clouds and multi-cloud deployments.

What is the main advantage of using deployments in Kubernetes? ›

Kubernetes helps DevOps teams work more efficiently, too. With Kubernetes, DevOps engineers can build, test, and deploy microservices apps in the same platform. This benefit eliminates the headache and risk that occur when apps developed in one platform have to move to a different one for production.

How do you deploy Kubernetes dashboard quickly and easily? ›

How to access and deploy Kubernetes Dashboard
  1. Create the service account. Create a file named dashboard-user.yaml with the following contents: ...
  2. Start the dashboard. ...
  3. Access the Kubernetes Dashboard. ...
  4. Stop the dashboard. ...
  5. Allow access with read-only user.
Feb 21, 2024

What is the most popular deployment strategy? ›

The most common strategy is to use a blue-green deployment. The new version (the blue version) is brought up for testing and evaluation, while the users still use the stable version (the green version). When ready, the users are switched to the blue version.

What is deployment in Kubernetes in simple words? ›

A Kubernetes Deployment tells Kubernetes how to create or modify instances of the pods that hold a containerized application. Deployments can help to efficiently scale the number of replica pods, enable the rollout of updated code in a controlled manner, or roll back to an earlier deployment version if necessary.

What is the difference between Kubernetes deployment and workload? ›

Workloads are objects that set deployment rules for pods. Based on these rules, Kubernetes performs the deployment and updates the workload with the current state of the application.

What is the difference between job and deployment in Kubernetes? ›

Kubernetes Jobs are designed for running batch tasks that complete and then terminate, while Deployments are used for managing long-running, continuously available applications.

What is the difference between release and deployment in Kubernetes? ›

To go a step further, a Kubernetes Deployment allows you to easily scale, update, and manage your Pods/ReplicaSets where as a Helm release allows you to easily install and manage a group of related Kubernetes resources that may be different resource types. Hope that helps!

What is deployment and stateful in Kubernetes? ›

Kubernetes is well-known for managing stateless services.

As far as deployment is concerned, pods are interchangeable. While a StatefulSet keeps a unique identity for each pod it manages. It uses the same identity whenever it needs to reschedule those pods.

Top Articles
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 6730

Rating: 4.4 / 5 (55 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.