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
Tired of fighting your Kubernetes platform?
Qovery provides a unified Kubernetes control plane for cluster provisioning, security, and deployments - giving you an enterprise-grade platform without the DIY overhead.
See it in action

Suggested articles

DevOps
Kubernetes
 minutes
Top 10 Platform9 Alternatives: Best managed Kubernetes solutions for scale

Need a better way to manage on-prem Kubernetes? Review 10 alternatives to Platform9, categorized by "Infrastructure Ops" (Rancher) vs. "Developer Experience" (Qovery).

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
Top 10 Rafay alternatives for enterprise Kubernetes operations

Is Rafay's complexity slowing you down? Compare the top 10 Rafay alternatives for 2026. From fleet managers like Rancher to developer platforms like Qovery, find the balance between control and velocity.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
Top 10 Spectro Cloud alternatives for multi-cluster fleet management

Don't just manage clusters. Modernize your stack. Compare Spectro Cloud vs. Qovery vs. Rancher to decide between "Fleet Operations" and "Developer Self-Service.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
 minutes
Top 10 VMware alternatives after the Broadcom acquisition

Hit by Broadcom's VMware price hikes? Compare the top 10 alternatives for 2026, from direct replacements like Proxmox and Nutanix to modernization platforms like Qovery.

Mélanie Dallé
Senior Marketing Manager
DevOps
Kubernetes
Platform Engineering
6
 minutes
10 Red Hat OpenShift alternatives to reduce licensing costs

Is OpenShift too expensive? Discover the best alternatives for 2026. Whether you need Developer Self-Service (Qovery) or Hybrid Cluster Ops (Rancher), find the right fit for your team.

Morgan Perry
Co-founder
Kubernetes
 minutes
Kubernetes management: Best practices for enterprise scaling and cost optimization

Master enterprise Kubernetes management in 2026. Learn best practices for security, FinOps, and reliability, and see how AI-agentic platforms simplify operations.

Mélanie Dallé
Senior Marketing Manager
Kubernetes
Platform Engineering
Infrastructure Management
 minutes
The top 3 OpenShift pains in 2026 (and how platform teams respond)

Is OpenShift becoming too expensive or complex for your team? Discover the top 3 OpenShift pain points; from the "pricing inversion" to vendor lock-in and see why agile platform teams are migrating to modular, developer-first alternatives like Qovery.

Mélanie Dallé
Senior Marketing Manager
AI
Qovery
3
 minutes
How Qovery uses Qovery to speed up its AI project

Discover how Qovery leverages its own platform to accelerate AI development. Learn how an AI specialist deployed a complex stack; including LLMs, QDrant, and KEDA - in just one day without needing deep DevOps or Kubernetes expertise. See how the "dogfooding" approach fuels innovation for our DevOps Copilot.

Romain Gérard
Staff Software Engineer

It’s time to change
the way you manage K8s

Turn Kubernetes into your strategic advantage with Qovery, automating the heavy lifting while you stay in control.