Blog
Kubernetes
DevOps
Platform Engineering
2
minutes

A Quick Technical Guide to Automating Kubernetes Deployments

Get a quick technical guide to automating Kubernetes deployments. Learn to use kubectl and YAML for consistent application setup, updates, and rollbacks in your cluster.
Morgan Perry
Co-founder
Summary
Twitter icon
linkedin icon

Automating Kubernetes deployments streamlines your development workflows and ensures consistency across environments.

This guide focuses on using native Kubernetes tools such as kubectl and YAML configuration files to automate your deployment processes.

Prerequisites

  • A working Kubernetes cluster
  • kubectl command-line tool installed
  • Basic understanding of Kubernetes concepts and YAML syntax

Step 1: Creating a Deployment YAML File

Start by creating a YAML file for your deployment. This file will define the desired state of your application in the Kubernetes cluster. Here’s a simple example of a YAML file for deploying a basic nginx container:

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx

This configuration creates a deployment named nginx-deployment, starting three replicas of the nginx container.

Step 2: Deploying with kubectl

To deploy the application to your Kubernetes cluster, run the following command:

kubectl apply -f nginx-deployment.yaml

This command instructs Kubernetes to set up the deployment as described in your YAML file.

Step 3: Automating Deployment Updates and Testing Automation

Automate with CI/CD Pipeline: Configure a CI/CD pipeline (e.g., Jenkins, GitLab CI, GitHub Actions) to automatically run kubectl apply -f <configuration-file>.yaml whenever changes are pushed to the main branch. Here is an example using GitLab CI:

deploy:
stage: deploy
script:
- kubectl apply -f nginx-deployment.yaml
only:
- main

Step 4:Testing the Automation

  • Make a change (e.g., update the nginx image version in the YAML file).
  • Commit and push the change; watch the CI/CD pipeline trigger and update the deployment.
  • Verify updates using kubectl rollout status deployment/nginx-deployment.
  • Optionally, test rollback by deploying a faulty configuration and then executing kubectl rollout undo deployment/nginx-deployment.

Step 5: Verifying the Deployment

After deploying, verify the status of your deployment with:

kubectl get deployments

This command provides details about the current deployments, including their desired and actual states.

Ready to Streamline Your Deployments?

For a deeper dive into how these and other tools can transform your CI/CD pipelines, read our Kubernetes automation tools article here.

Share on :
Twitter icon
linkedin icon
Ready to rethink the way you do DevOps?
Qovery is a DevOps automation platform that enables organizations to deliver faster and focus on creating great products.
Book a demo

Suggested articles

Cloud
Heroku
Internal Developer Platform
Platform Engineering
9
 minutes
The Top 8 Platform as a Service (Paas) Tools in 2026

Build Your Own PaaS: Stop depending on fixed cloud offerings. Discover the top 8 tools, including Qovery, Dokku, and Cloud Foundry, that let you build a customizable, low-maintenance PaaS on your cloud infrastructure.

Morgan Perry
Co-founder
Kubernetes
 minutes
How to Deploy a Docker Container on Kubernetes: Step-by-Step Guide

Simplify Kubernetes Deployment. Learn the difficult 6-step manual process for deploying Docker containers to Kubernetes, the friction of YAML and kubectl, and how platform tools like Qovery automate the entire workflow.

Mélanie Dallé
Senior Marketing Manager
Observability
DevOps
 minutes
Observability in DevOps: What is it, Observe vs. Monitoring, Benefits

Observability in DevOps: Diagnose system failures faster. Learn how true observability differs from traditional monitoring. End context-switching, reduce MTTR, and resolve unforeseen issues quickly.

Mélanie Dallé
Senior Marketing Manager
DevOps
Cloud
8
 minutes
6 Best Practices to Automate DevSecOps in Days, Not Months

Integrate security seamlessly into your CI/CD pipeline. Learn the 6 best DevSecOps practices—from Policy as Code to continuous monitoring—and see how Qovery automates compliance and protection without slowing development.

Morgan Perry
Co-founder
Heroku
15
 minutes
Heroku Alternatives: The 10 Best Competitor Platforms

Fed up of rising Heroku costs and frequent outages? This guide compares the top 10 Heroku alternatives and competitors based on features, pricing, pros, and cons—helping developers and tech leaders choose the right PaaS.

Mélanie Dallé
Senior Marketing Manager
Product
Infrastructure Management
Deployment
 minutes
Stop tool sprawl - Welcome to Terraform/OpenTofu support

Provisioning cloud resources shouldn’t require a second stack of tools. With Qovery’s new Terraform and OpenTofu support, you can now define and deploy your infrastructure right alongside your applications. Declaratively, securely, and in one place. No external runners. No glue code. No tool sprawl.

Alessandro Carrano
Head of Product
AI
DevOps
 minutes
Integrating Agentic AI into Your DevOps Workflow

Eliminate non-coding toil with Qovery’s AI DevOps Agent. Discover how shifting from static automation to specialized DevOps AI agents optimizes FinOps, security, and infrastructure management.

Mélanie Dallé
Senior Marketing Manager
DevOps
 minutes
Top 10 Flux CD Alternatives: Finding a Better Way to Deploy Your Code

Looking for a Flux CD alternative? Discover why Qovery stands out as the #1 choice. Compare features, pros, and cons of the top 10 platforms to simplify your deployment strategy and empower your team.

Mélanie Dallé
Senior Marketing Manager

It’s time to rethink
the way you do DevOps

Say goodbye to DevOps overhead. Qovery makes infrastructure effortless, giving you full control without the trouble.