Deploying Applications with Kubectl in Kubernetes

Kubectl Deploymant Workflow

The process for deploying applications using Kubectl involves several key steps:

  1. Verify cluster readiness (Minikube or kubeadm)
  2. Create Deployment configuration
  3. Apply the configuration
  4. Verify deployment status

Deploying a Sample Web Application

1. Creating the Deployment Configuration

A Deployment object manages application instances through ReplicaSets. Here's a sample configuration:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: webapp-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      service: webapp
  template:
    metadata:
      labels:
        service: webapp
    spec:
      containers:
      - name: web-container
        image: nginx:latest
        ports:
        - containerPort: 80

Key components:

  • replicas: Number of identical Pod instances
  • selector: Criteria for identifying managed Pods
  • template: Blueprint for Pod creation

2. Applying the Deployment

Execute the deployment using:

kubectl apply -f webapp-deployment.yaml

3. Verifying Deployment Status

Check deployement progress with:

kubectl get deployment webapp-deployment

Output columns indicate:

  • READY: Current vs. desired Pod count
  • UP-TO-DATE: Updated replicas
  • AVAILABLE: Ready-to-use replicas
  • AGE: Time since creation

To inspect related ReplicaSets:

kubectl get replicasets -lservice=webapp

ReplicaSet names follow the pattern [deployment-name]-[random-hash]. View Pod details with:

kubectl get pods -lservice=webapp --show-labels

Tags: kubernetes kubectl deployment containerization devops

Posted on Tue, 19 May 2026 07:14:38 +0000 by chokies12