NV24212 Task 2

NV: NV24212

Name: Hasan Mahmood

controlplane:~$ echo NV24212 Hasan Mahmood
NV24212 Hasan Mahmood

2. Cluster Node Verification

Before deploying resources, the cluster nodes and their versions were checked.

controlplane:~$ kubectl get nodes
NAME            STATUS    ROLES           AGE    VERSION
controlplane    Ready     control-plane   24d    v1.34.3
node01          Ready     <none>          24d    v1.34.3

3. Pod Creation (Imperative Method)

The following pods were created using the kubectl run command:

controlplane:~$ kubectl run nginx-pod --image=nginx
pod/nginx-pod created
controlplane:~$ kubectl run redis-pod --image=redis
pod/redis-pod created
controlplane:~$ kubectl run apache-pod --image=httpd
pod/apache-pod created

4. Pod Inspection and IPs

Verification of the Pod IP addresses and Node placement using the -o wide flag.

controlplane:~$ kubectl get pods -o wide
NAME        READY   STATUS    RESTARTS   AGE     IP            NODE     NOMINATED NODE   READINESS GATES
apache-pod  1/1     Running   0          8m20s   192.168.1.6   node01   <none>           <none>
nginx-pod   1/1     Running   0          8m37s   192.168.1.4   node01   <none>           <none>
redis-pod   1/1     Running   0          8m27s   192.168.1.5   node01   <none>           <none>

Verification Checklist:

5. Detailed Resource Inspection (Nginx )

Command describe output showing container images and lifecycle events.

controlplane:~$ kubectl describe pod nginx-pod
Name:              nginx-pod
Status:            Running
IP:                192.168.1.4
Containers:
  nginx-pod:
    Image:          nginx
    State:          Running
      Started:      Wed, 25 Feb 2026 08:05:26 +0000
Events:
  Type    Reason     Age    From               Message
  ----    ------     ----   ----               -------
  Normal  Scheduled  10m    default-scheduler  Successfully assigned default/nginx-pod to node01
  Normal  Pulling    10m    kubelet            Pulling image "nginx"
  Normal  Pulled     10m    kubelet            Successfully pulled image "nginx"
  Normal  Created    10m    kubelet            Created container: nginx-pod
  Normal  Started    10m    kubelet            Started container nginx-pod

6. Maintenance and Cleanup

During the session, the apache-pod was deleted, and terminal typos were encountered and corrected.

Commands and Errors:

# Correcting typo from "podes" to "pods"
controlplane:~$ kubectl get podes
error: the server doesn't have a resource type "podes"

# Deleting the Apache pod
controlplane:~$ kubectl delete pod apache-pod
pod "apache-pod" deleted from default namespace

# Verifying final state
controlplane:~$ kubectl get pods
NAME        READY   STATUS    RESTARTS   AGE
nginx-pod   1/1     Running   0          9m16s
redis-pod   1/1     Running   0          9m6s

7. Learning Outcomes

Final Verification:

controlplane:~$ echo NV24212 Hasan Mahmood
NV24212 Hasan Mahmood

7. Raw Terminal Text

Initialising Kubernetes... done

controlplane:~$ kubectl run nginx-pod --image=nginx
pod/nginx-pod created
controlplane:~$ kubectl run redis-pod --image=redis
pod/redis-pod created
controlplane:~$ kubectl run apache-pod --image=httpd
pod/apache-pod created
controlplane:~$ kubectl get pods -o wide
NAME         READY   STATUS    RESTARTS   AGE   IP            NODE     NOMINATED NODE   READINESS GATES
apache-pod   1/1     Running   0          15s   192.168.1.6   node01   <none>           <none>
nginx-pod    1/1     Running   0          32s   192.168.1.4   node01   <none>           <none>
redis-pod    1/1     Running   0          22s   192.168.1.5   node01   <none>           <none>
controlplane:~$ kubectl describe pod nginx-pod
Name:             nginx-pod
Namespace:        default
Priority:         0
Service Account:  default
Node:             node01/172.30.2.2
Start Time:       Wed, 25 Feb 2026 08:05:19 +0000
Labels:           run=nginx-pod
Annotations:      cni.projectcalico.org/containerID: 08706797b6f3fcfaf3010c072264bad4485a1c6abe5029526e993204eab6d401
                  cni.projectcalico.org/podIP: 192.168.1.4/32
                  cni.projectcalico.org/podIPs: 192.168.1.4/32
Status:           Running
IP:               192.168.1.4
IPs:
  IP:  192.168.1.4
Containers:
  nginx-pod:
    Container ID:   containerd://03aa73820eae9399fb5b166c1c242da088a3e59afc9a4e497dc17186feb11d4e
    Image:          nginx
    Image ID:       docker.io/library/nginx@sha256:0d1b1f0656a7cb1e2e8135bb1ea99d889ee5d3345fc20388da3f555ad77cf2dc
    Port:           <none>
    Host Port:      <none>
    State:          Running
      Started:      Wed, 25 Feb 2026 08:05:26 +0000
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-ztdrw (ro)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True 
  Initialized                 True 
  Ready                       True 
  ContainersReady             True 
  PodScheduled                True 
Volumes:
  kube-api-access-ztdrw:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    Optional:                false
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  108s  default-scheduler  Successfully assigned default/nginx-pod to node01
  Normal  Pulling    107s  kubelet            Pulling image "nginx"
  Normal  Pulled     101s  kubelet            Successfully pulled image "nginx" in 5.623s (5.623s including waiting). Image size: 62944796 bytes.
  Normal  Created    101s  kubelet            Created container: nginx-pod
  Normal  Started    101s  kubelet            Started container nginx-pod
controlplane:~$ kubectl describe pod redis-pod
Name:             redis-pod
Namespace:        default
Priority:         0
Service Account:  default
Node:             node01/172.30.2.2
Start Time:       Wed, 25 Feb 2026 08:05:29 +0000
Labels:           run=redis-pod
Annotations:      cni.projectcalico.org/containerID: b33743d105fe189ac8e04253ec642fdef7c27a4c5d460e06c9811156c71feea9
                  cni.projectcalico.org/podIP: 192.168.1.5/32
                  cni.projectcalico.org/podIPs: 192.168.1.5/32
Status:           Running
IP:               192.168.1.5
IPs:
  IP:  192.168.1.5
Containers:
  redis-pod:
    Container ID:   containerd://651265130e18a72107fcf92cf1438d4e2391d2acc4a9c44b085f0f47abcd17f1
    Image:          redis
    Image ID:       docker.io/library/redis@sha256:5cb00b0f236e286254ce9f3eea989b00bb69d04fb9b6c9a9d0b07e588e49f44e
    Port:           <none>
    Host Port:      <none>
    State:          Running
      Started:      Wed, 25 Feb 2026 08:05:33 +0000
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-4fskc (ro)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True 
  Initialized                 True 
  Ready                       True 
  ContainersReady             True 
  PodScheduled                True 
Volumes:
  kube-api-access-4fskc:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    Optional:                false
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  103s  default-scheduler  Successfully assigned default/redis-pod to node01
  Normal  Pulling    103s  kubelet            Pulling image "redis"
  Normal  Pulled     100s  kubelet            Successfully pulled image "redis" in 3.14s (3.14s including waiting). Image size: 53253810 bytes.
  Normal  Created    99s   kubelet            Created container: redis-pod
  Normal  Started    99s   kubelet            Started container redis-pod
controlplane:~$ kubectl describe pod apache-pod
Name:             apache-pod
Namespace:        default
Priority:         0
Service Account:  default
Node:             node01/172.30.2.2
Start Time:       Wed, 25 Feb 2026 08:05:36 +0000
Labels:           run=apache-pod
Annotations:      cni.projectcalico.org/containerID: a847202688c52e35e7c2ea65da5afe6c0641b517e78640d7e7cb442fcdf833fe
                  cni.projectcalico.org/podIP: 192.168.1.6/32
                  cni.projectcalico.org/podIPs: 192.168.1.6/32
Status:           Running
IP:               192.168.1.6
IPs:
  IP:  192.168.1.6
Containers:
  apache-pod:
    Container ID:   containerd://c528976978a397cfdd8b2ff2f17430370f090905fb9e7380d77b6389bbaf6feb
    Image:          httpd
    Image ID:       docker.io/library/httpd@sha256:96b1e8f69ee3adde956e819f7a7c3e706edef7ad88a26a491734015e5c595333
    Port:           <none>
    Host Port:      <none>
    State:          Running
      Started:      Wed, 25 Feb 2026 08:05:40 +0000
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lb56h (ro)
Conditions:
  Type                        Status
  PodReadyToStartContainers   True 
  Initialized                 True 
  Ready                       True 
  ContainersReady             True 
  PodScheduled                True 
Volumes:
  kube-api-access-lb56h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    Optional:                false
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  101s  default-scheduler  Successfully assigned default/apache-pod to node01
  Normal  Pulling    100s  kubelet            Pulling image "httpd"
  Normal  Pulled     97s   kubelet            Successfully pulled image "httpd" in 2.729s (2.729s including waiting). Image size: 45242947 bytes.
  Normal  Created    97s   kubelet            Created container: apache-pod
  Normal  Started    97s   kubelet            Started container apache-pod
controlplane:~$ echo NV24212 Hasan Mahmood
NV24212 Hasan Mahmood
controlplane:~$ kubectl get nodes
NAME           STATUS   ROLES           AGE   VERSION
controlplane   Ready    control-plane   24d   v1.34.3
node01         Ready    <none>          24d   v1.34.3
controlplane:~$ kubectl get podes
error: the server doesn't have a resource type "podes"
controlplane:~$ kubectl get pods 
NAME         READY   STATUS    RESTARTS   AGE
apache-pod   1/1     Running   0          8m20s
nginx-pod    1/1     Running   0          8m37s
redis-pod    1/1     Running   0          8m27s
controlplane:~$ kubectl delete apache-pod
error: the server doesn't have a resource type "apache-pod"
controlplane:~$ kubectl delete pod apache-pod
pod "apache-pod" deleted from default namespace
controlplane:~$ kubectl get podes 
error: the server doesn't have a resource type "podes"
controlplane:~$ kubectl get pods
NAME        READY   STATUS    RESTARTS   AGE
nginx-pod   1/1     Running   0          9m16s
redis-pod   1/1     Running   0          9m6s
controlplane:~$ ^C
controlplane:~$