DevOps Classroom notes 09/Oct/2026

Kubernetes ReplicationController (RC) and ReplicaSet (RS)

To deploy RelipcationController create file rc.yaml and add below yaml data

apiVersion: v1
kind: ReplicationController
metadata:
  name: nopcommerce-rc
  labels:
    app: nopcommerce
spec:
  replicas: 3
  selector:
    app: nopcommerce
  template:
    metadata:
      labels:
        app: nopcommerce
    spec:
      containers:
      - name: nopcommerce-container
        image: httpd:latest
        ports:
        - containerPort: 80
        resources:
          limits:
            memory: "512Mi"
            cpu: "500m"
          requests:
            memory: "256Mi"
            cpu: "250m"
# deploy yaml file
kubectl apply -f rc.yaml

# get all pods 
kubectl get pods  # verify pods == replicas count
kuebctl get po

# try to delete pod and verify again it will create new pod
kubectl delete pods <podnames>

# Verify rc 
kubectl get replicationcontroller 
kubectl get rc

To deploy Relipcaset create file rs.yaml and add below yaml data

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: httpd-rs
  labels:
    app: apache2
    environment: production
spec:
  replicas: 2
  selector:
    matchLabels:
      app: apache2
      environment: production
  template:
    metadata:
      labels:
        app: apache2
        environment: production
    spec:
      containers:
        - name: apache2
          env:
            - name: ENVIRONMENT
              value: production
            - name: APP_VERSION
              value: "4.0"
          image: httpd:latest
          ports:
            - name: http
              protocol: TCP
              containerPort: 80
            
# deploy yaml file
kubectl apply -f rs.yaml

# get all pods 
kubectl get pods  # verify pods == replicas count
kuebctl get po

# try to delete pod and verify again it will create new pod
kubectl delete pods <podnames>

# Verify rc 
kubectl get replicaset
kubectl get rs

Deployment

  • A deployement manage Replicaset. which it trun to provide
    • Desire state for pods
    • Rolling update and rollback
    • revision History versions

Rfere_here for sample deployment yaml

deployment

kubectl apply -f deployment.yaml 

kubectl get rs # see rs name is deployment name + uniqe id 

kubectl get pod # sea pods name will deployment name + rs uniqe id + every pod will its own id 

kubectl scale deployment <deployment-name> --replicas=0

kubectl scale deployment nginx-deployment --replicas=0 # scale down

kubectl scale deployment nginx-deployment --replicas=5 # scale up 

Kubectl delete deployment <deployment name >

kubect get deployement # full cmd

kubectl get deploy # short cmd

Offical docs

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube