DevOps Jul 10, 2020

Kubernetes Deployment: Best Practices Providing Resilient Apps and Infrastructure

Jane Vyshnova

Jane Vyshnova

CEO

Author

Kubernetes Deployment: Best Practices Providing Resilient Apps and Infrastructure

Time to read: 13 minutes

Content

  1. What is Kubernetes And Why is It So Popular Among IT Teams?
  2. Kubernetes Architecture
  3. What Is a Kubernetes Deployment?
  4. How to Implement Kubernetes?
  5. Conclusion
Bookmark

A Kubernetes Deployment declares how many copies of a stateless application should run and replaces them with a new version gradually, with a rollback path if the new version fails. The app stays available through releases and failures when you combine a few settings: more than one replica spread across nodes or zones, readiness, liveness and startup probes, CPU and memory requests, a rolling-update strategy with safe surge and unavailability limits, a PodDisruptionBudget, and autoscaling. The checklist and example manifest below show all of them in one place. If you are deciding whether you need Kubernetes at all, start with "How to Implement Kubernetes?" below.

Manually updating containerised applications is not a job for the faint-hearted. It means stopping the old version, starting a new one, waiting and checking that the launch succeeded, and rolling back to the previous version in case of error. All this takes serious effort and can slow the release process down.

If you want to reduce release time, deploy without downtime, update applications and features more often, or work with more agility, a Kubernetes Deployment will help you. The Kubernetes facts in this article come from the official documentation at kubernetes.io for Kubernetes 1.37, the newest minor release when we checked on 18 November 2026.

What is Kubernetes And Why is It So Popular Among IT Teams?

The Kubernetes documentation describes Kubernetes as "a portable, extensible, open source platform for managing containerized workloads and services that facilitate both declarative configuration and automation". Google open-sourced the project in 2014. It is a graduated project of the Cloud Native Computing Foundation (CNCF), which accepted it in 2016, and it is developed by a large community of contributors and partners.

The more companies move to microservices and cloud architectures with containers, the greater the demand for a reliable, proven platform to run them. Why use Kubernetes? Its main advantages:

  1. Kubernetes is fast to work with. It is not a traditional, all-inclusive platform as a service (PaaS), but, in the documentation's words, it "provides the building blocks for building developer platforms". On top of it, teams can request resources for additional load through the same declarative API, and automate packaging, deployment and testing with tools designed for Kubernetes.
  2. Kubernetes uses resources efficiently. You tell Kubernetes how much CPU and memory each container needs, and it fits containers onto your nodes "to make the best use of your resources" (automatic bin packing). It also restarts containers that fail and replaces containers that do not respond to your health checks.
  3. Kubernetes is independent of specific cloud platforms. The major clouds offer managed Kubernetes services, such as Amazon Elastic Kubernetes Service (Amazon EKS), Azure Kubernetes Service (AKS) and Google Kubernetes Engine (GKE), and Kubernetes also runs on-premises. When you move workloads, you do not have to re-engineer the applications or redraw the whole infrastructure, which helps you avoid being tied to one vendor.

This allows you to:

Kubernetes Architecture

In the documentation's words, "a Kubernetes cluster consists of a control plane plus a set of worker machines, called nodes, that run containerized applications". In production, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, which gives fault tolerance and high availability.

What Is a Kubernetes Deployment?

A Deployment "provides declarative updates for Pods and ReplicaSets". It describes the life cycle of an application: which container images to use, how many Pods (replicas) should run, and how to update them. Its main benefit is that the right number of Pods is running and available at all times. Every update creates a new revision, so a rollout can be paused, resumed or rolled back to an earlier revision.

How Kubernetes works

With a Deployment object, you can:

Kubernetes in action

A Deployment is usually written as a YAML manifest that defines the Pod template and the number of replicas. The Deployment manages a ReplicaSet, and the ReplicaSet keeps the required number of Pods running: if a node fails, replacement Pods are scheduled on other available nodes.

A DaemonSet is a different workload object: it runs a copy of a Pod on every node (or on the nodes you choose). The documentation lists typical uses such as a cluster storage daemon, a logs collection daemon or a node monitoring daemon on every node. Use a Deployment for your application and a DaemonSet for node-level agents.

Resilient Deployment checklist

Use this checklist when you review a Deployment before production. Every item maps to a field or object in the current Kubernetes API.

PracticeWhere you set itWhy it mattersCheck before release
Run more than one replicaspec.replicasOne Pod is a single point of failureAt least two Pods are Ready
Spread replicas across nodes or zonestopologySpreadConstraints in the Pod templateA node or zone failure should not take out every replicaPods are on different nodes or zones
Readiness probereadinessProbeA Pod that is not ready is removed from Service endpoints and gets no trafficThe probe checks the app's dependencies, not just the process
Liveness and startup probeslivenessProbe, startupProbeRestarts a deadlocked container; gives slow starters time before liveness checks beginLiveness signals only unrecoverable failure, so it does not restart Pods under load
CPU and memory requests (and a memory limit)resources.requests, resources.limitsThe scheduler places Pods by requests; utilisation-based autoscaling needs themRequests reflect measured usage
Safe rolling updatestrategy.rollingUpdate.maxSurge, maxUnavailableControls how many Pods are added or removed at a time (default 25% each)With maxUnavailable: 0, capacity never drops during a release
Rollout deadline and historyprogressDeadlineSeconds (default 600), revisionHistoryLimit (default 10)A stuck rollout is reported; old revisions stay available for rollbackkubectl rollout undo works in a test run
Disruption budgetPodDisruptionBudget (policy/v1)Limits how many Pods voluntary disruptions, such as node drains, can take down at onceminAvailable is lower than replicas, or drains will block
AutoscalingHorizontalPodAutoscaler (autoscaling/v2)Adds or removes replicas based on observed utilisationMinimum and maximum replicas are set and tested under load

An example manifest that applies the checklist (illustrative names and values; set probes and resources from your own application):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: storefront
spec:
  replicas: 3
  selector:
    matchLabels:
      app: storefront
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: storefront
    spec:
      topologySpreadConstraints:
      - maxSkew: 1
        topologyKey: topology.kubernetes.io/zone
        whenUnsatisfiable: ScheduleAnyway
        labelSelector:
          matchLabels:
            app: storefront
      containers:
      - name: storefront
        image: registry.example.com/storefront:1.4.2
        ports:
        - containerPort: 8080
        resources:
          requests:
            cpu: 250m
            memory: 256Mi
          limits:
            memory: 512Mi
        startupProbe:
          httpGet:
            path: /healthz
            port: 8080
          failureThreshold: 30
          periodSeconds: 5
        readinessProbe:
          httpGet:
            path: /ready
            port: 8080
          periodSeconds: 5
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
          periodSeconds: 10
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: storefront-pdb
spec:
  minAvailable: 2
  selector:
    matchLabels:
      app: storefront
Rolling update of a Kubernetes Deployment Rolling update of a Deployment with three replicas, maxSurge 1 and maxUnavailable 0. 1: three version 1 Pods serve traffic. 2: one version 2 Pod starts (surge of one); it receives traffic only after its readiness probe passes. 3: one version 1 Pod is removed, so three Pods stay available. 4: the cycle repeats until three version 2 Pods run. If new Pods never become ready, the rollout stops progressing and is reported after progressDeadlineSeconds (default 600); roll back with kubectl rollout undo. Rolling update: capacity never drops replicas 3, maxSurge 1, maxUnavailable 0 1 Before the release v1 v1 v1 all Ready, serving traffic 2 Surge: one new Pod v1 v1 v1 + v2 (starting) v2 gets traffic only when its readiness probe passes 3 Replace one old Pod v1 v1 v2 three Pods available 4 Repeat until done v2 v2 v2 new revision complete If v2 never becomes Ready Rollout stops progressing; reported after progressDeadlineSeconds (default 600) Roll back: kubectl rollout undo
How a rolling update keeps capacity: new Pods must pass the readiness probe before old ones are removed.

Basic deployment strategies of Kubernetes

A Deployment has two built-in strategies, set in .spec.strategy.type:

Other release patterns are not built-in strategies; teams build them on top of Deployments and Services:

Kubernetes microservices in theoretical aspects

Developers used to build monolithic web applications: large codebases that grew features until they became slow and hard to manage. Many teams have since found microservices easier to scale and change. A common first step is to separate the front end from the back end (API) and then split out further services where it pays off.

Once you decide to use microservices, the question is where to run them so that they stay reliable and easy to manage. Docker is a popular tool for the development cycle: developers run applications and services in local containers and build images that continuous integration then deploys. But how do you schedule many containers, make them talk to each other and scale many instances? That's where Kubernetes comes in.

Docker and Kubernetes - correct work together

These technologies do different jobs, so it is not fair to compare them or to ask which one should come first. Docker is commonly used to build and run container images; Kubernetes runs containers across a cluster. Since Kubernetes 1.24, Kubernetes no longer includes dockershim and runs containers through a runtime that implements the Container Runtime Interface (CRI), such as containerd or CRI-O. Your images are not affected: the Kubernetes project states that "the images produced from docker build will work with all CRI implementations".

Use Docker-built images and Kubernetes together to:

  1. Keep the application available. It stays online even if some nodes leave the cluster, as long as replicas run on other nodes.
  2. Scale the application. When the load increases, run more Pods or add more nodes to the cluster.

Kubernetes microservice - restructuring for freedom and autonomous work

Software architects have long tried to split monolithic applications into reusable components. Microservices make it easier to:

Another advantage of microservices is the freedom to choose the right tool for each job: some parts of an application may benefit from a fast compiled language, others from higher-level languages such as Python or JavaScript. Based on our experience, a good Kubernetes implementation allocates computing resources carefully, so that you do not pay for capacity you don't use.

Why Kubernetes? The convenience of the Kubernetes monitoring system

Kubernetes "does not dictate logging, monitoring, or alerting solutions"; it provides "mechanisms to collect and export metrics", and you choose the monitoring tools on top. An important aspect of monitoring Kubernetes is its label system: consistent labels on Deployments, Pods and Services let you see how objects in the cluster relate and filter metrics by application, release or team. Make the readiness probe and the rollout status part of what you monitor, because they show a failing release before customers do.

Three Kubernetes autoscaling tools

Kubernetes offers scaling at three levels:

Autoscaling makes the cluster flexible and helps it meet changing demand, but it does not replace load testing: check that the application, the database and any third-party APIs can handle the maximum number of replicas you allow.

Azure Kubernetes service discovery

On Microsoft Azure, the managed option is Azure Kubernetes Service (AKS), which Microsoft describes as a way to "deploy and scale containers on managed Kubernetes". With a managed service, the provider runs the control plane, and your team concentrates on workloads, node pools and integrations with other Azure services. You can create a cluster through the Azure portal or with command-line tools.

Kubernetes on AWS: manage easier

On AWS, the managed option is Amazon Elastic Kubernetes Service (Amazon EKS). (Amazon Elastic Container Service, ECS, is a different, non-Kubernetes container service.) A big advantage of EKS and similar managed Kubernetes services is that they remove the operational burden of running the control plane yourself, which lets your team focus on application development.

How to Implement Kubernetes?

Kubernetes is not the right answer for every application, and adopting it is a project in its own right. It pays off when you run several services, release often, need to scale parts of the system independently, or want the same deployment model across clouds and on-premises. A single small application with infrequent releases may be served better by a managed platform that runs containers without a cluster to look after.

Kubernetes implementation plan

Kubernetes has evolved quickly since its release, and keeping up is part of the work: the project maintains release branches for the most recent three minor releases, so plan regular cluster upgrades from the start. A practical plan:

  1. Audit and containerise. Decide which services move first, write Dockerfiles, and remove assumptions about local disks and fixed hosts.
  2. Choose managed or self-managed. For most ecommerce teams, a managed service (EKS, AKS or GKE) reduces the operations load.
  3. Define environments as code. Create clusters, networks and access rules with infrastructure-as-code tools, so testing, staging and production match.
  4. Build the delivery pipeline. Each code change builds an image, runs tests and deploys through CI/CD, with an easy rollback.
  5. Apply the resilience checklist above to every Deployment.
  6. Set up monitoring, logging and alerts, including rollout status and probe failures.
  7. Plan upgrades and capacity: a schedule for Kubernetes minor releases and a load test before peak sales periods.

Organisations that switch to Kubernetes need people who write code, run operations and understand the application architecture, storage and data procedures. For Deutsche Telekom's Croatian subsidiary, Dinarys containerised dedicated telecom applications and deployed them on OpenShift, Red Hat's platform with Kubernetes at its core. Senior DevOps specialists worked on the project for six months: a code change builds a new Docker image and the application deploys on OpenShift; GitLab, Jenkins and OpenShift were integrated, SSL configured, and CI/CD improved for several development teams that use different technologies. The work followed seven stages, from discovery and audit through implementation and testing to a maintenance plan and training.

Platform constraints can also decide a larger project. In the Prostor case, the case page lists the lack of a path to Kubernetes-compatible infrastructure among the architectural constraints that ruled out performance patching and custom extensions on the existing platform.

Kubernetes: up and running with us

Would you like to plan and develop a complete, mostly automated deployment system from scratch? Do you need optimisation or a technical audit? We will take over the management of your Kubernetes and Docker platform so you can focus on what matters more: delivering applications to your users. See our DevOps support and maintenance services, and read about our DevOps development process and how to ensure cloud scalability.

Conclusion

With Kubernetes, a system becomes more resilient and easier to manage: Deployments replace Pods at a controlled rate, probes keep broken Pods out of traffic, disruption budgets protect capacity during maintenance, and autoscaling follows demand. Used with resource requests and autoscaling, it also helps you make better use of your computing resources. We have been working with DevOps for a long time, including the container and CI/CD project described above.

Interested in Kubernetes deployment but don't know where to start? Contact us to discuss your project.

Let professionals meet your challenge

Our certified specialists will find the most optimal solution for your business.

Please enter valid name
Please enter valid company
Please enter a valid phone
Please enter valid E-mail
Message is too short

    Your message has been successfully sent. We will be in touch shortly! Success icon