Profile picture
Sidharth R
  • Home
  • Posts
  • Journal
  • Home
  • Posts
  • Journal
  • Search
  1. Home
  2. Labs - Learn by Doing
  3. Kubernetes labs
  4. Deployments in Kubernetes

Deployments in Kubernetes

Updated: 06 May 2026 ⚬ Page views: loading...

Tasks

Task 1

How many PODs exist on the system?

$ k get po
No resources found in default namespace.

Ans: 0

Task 2

How many ReplicaSets exist on the system?

$ k get rs
No resources found in default namespace.

Task 3

How many Deployments exist on the system?

$ k get deploy
No resources found in default namespace.

Task 4

How many Deployments exist on the system now?

list deployments
$ k get deploy
NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
frontend-deployment   0/4     4            0           37s

Ans: 1

Task 5

How many ReplicaSets exist on the system now?

$ k get rs
NAME                             DESIRED   CURRENT   READY   AGE
frontend-deployment-685654657c   4         4         0       3m1s

Task 6

How many PODs exist on the system now?

list pods
$ k get po
NAME                                   READY   STATUS             RESTARTS   AGE
frontend-deployment-685654657c-5cw7s   0/1     ImagePullBackOff   0          3m36s
frontend-deployment-685654657c-hg7km   0/1     ImagePullBackOff   0          3m36s
frontend-deployment-685654657c-mdhnp   0/1     ImagePullBackOff   0          3m36s
frontend-deployment-685654657c-vs9p7   0/1     ImagePullBackOff   0          3m36s

Ans: 4

Task 7

Out of all the existing PODs, how many are ready?

Ans: 0

Task 8

What is the image used to create the pods in the new deployment?

describe pod
$ k describe po frontend-deployment-685654657c-5cw7s 
Name:             frontend-deployment-685654657c-5cw7s
Namespace:        default
Priority:         0
Service Account:  default
Node:             controlplane/10.244.167.61
Start Time:       Wed, 06 May 2026 16:21:13 +0000
Labels:           name=busybox-pod
                  pod-template-hash=685654657c
Annotations:      
Status:           Pending
IP:               10.22.0.10
IPs:
  IP:           10.22.0.10
Controlled By:  ReplicaSet/frontend-deployment-685654657c
Containers:
  busybox-container:
    Container ID:  
    Image:         busybox888
    Image ID:      
    Port:          
    Host Port:     

Ans: busybox888

Task 9

Why do you think the deployment is not ready?

Pod events
$ k describe po frontend-deployment-685654657c-5cw7s 

Events:
  Type     Reason     Age                     From               Message
  ----     ------     ----                    ----               -------
  Normal   Scheduled  7m31s                   default-scheduler  Successfully assigned default/frontend-deployment-685654657c-5cw7s to controlplane
  Normal   Pulling    4m28s (x5 over 7m31s)   kubelet            spec.containers{busybox-container}: Pulling image "busybox888"
  Warning  Failed     4m27s (x5 over 7m30s)   kubelet            spec.containers{busybox-container}: Failed to pull image "busybox888": failed to pull and unpack image "docker.io/library/busybox888:latest": failed to resolve reference "docker.io/library/busybox888:latest": pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
  Warning  Failed     4m27s (x5 over 7m30s)   kubelet            spec.containers{busybox-container}: Error: ErrImagePull
  Normal   BackOff    2m17s (x21 over 7m30s)  kubelet            spec.containers{busybox-container}: Back-off pulling image "busybox888"
  Warning  Failed     2m17s (x21 over 7m30s)  kubelet            spec.containers{busybox-container}: Error: ImagePullBackOff

Ans: The image doesn’t exist

Task 10

Create a new Deployment using the deployment-definition-1.yaml file located at /root/. There is an issue with the file, so try to fix it.

Solution

Let’s inspect the file.

deployment-definition-1.yaml
---
apiVersion: apps/v1
kind: deployment
metadata:
  name: deployment-1
spec:
  replicas: 2
  selector:
    matchLabels:
      name: busybox-pod
  template:
    metadata:
      labels:
        name: busybox-pod
    spec:
      containers:
      - name: busybox-container
        image: busybox
        command:
        - sh
        - "-c"
        - echo Hello Kubernetes! && sleep 3600

Here kind: deployment should be corrected to kind: Deployment.

You can also see the same by running:

$ k explain deploy | head -n 3
GROUP:      apps
KIND:       Deployment
VERSION:    v1

Now you can create a deployment using:

$ k create -f deployment-definition-1.yaml 
deployment.apps/deployment-1 created

Task 11

Create a new Deployment with the below attributes using your own deployment definition file.

  • Name: httpd-frontend
  • Replicas: 3
  • Image: httpd:2.4-alpine
Show solution

First, generate a Deployment file using

k create deploy --image=httpd:2.4-alpine --replicas=3 ht
tpd-frontend --dry-run=client -o yaml > https-alpine.yaml

Then create a Deployment:

$ k create -f httpd-alpine.yaml 
deployment.apps/httpd-frontend created

Verify :

$ k get deploy
NAME                  READY   UP-TO-DATE   AVAILABLE   AGE
httpd-frontend        3/3     3            3           66s

Nerdsid.com

Links
  • Home
  • Contact
  • About
  • Posts
  • Journal
  • Quotes
  • Links worth your time
  • Notes
  • Style guide
© 2026 Sidharth R.
All content on this website is licensed under CC BY-NC-SA 4.0.