Sunday, 12 October 2025

Fix Broken Redis Deployments in Kubernetes: Real-World Troubleshooting Guide

 Our course you can check :-   Udemy course  


Ques:- 

DevOps team deployed a redis app on Kubernetes cluster, which was working fine so far. This morning one of the team members was making some changes in this existing setup, but he made some mistakes and the app went down. We need to fix this as soon as possible. Please take a look.

The deployment name is redis-deployment. The pods are not in running state right now, so please look into the issue and fix the same.


Ans:-

raj@jumphost ~$ kubectl get deploy

NAME               READY   UP-TO-DATE   AVAILABLE   AGE

redis-deployment   0/1     1            0           31s


raj@jumphost ~$ kubectl get pod

NAME                                READY   STATUS              RESTARTS   AGE

redis-deployment-54cdf4f76d-x5wxs   0/1     ContainerCreating   0          39s


raj@jumphost ~$ kubectl describe pod redis-deployment-54cdf4f76d-x5wxs

Name:             redis-deployment-54cdf4f76d-x5wxs

Namespace:        default

Priority:         0

Service Account:  default

Node:             kodekloud-control-plane/172.17.0.2

Start Time:       Sun, 12 Oct 2025 11:05:25 +0000

Labels:           app=redis

                  pod-template-hash=54cdf4f76d

Annotations:      <none>

Status:           Pending

IP:               

IPs:              <none>

Controlled By:    ReplicaSet/redis-deployment-54cdf4f76d

Containers:

  redis-container:

    Container ID:   

    Image:          redis:alpin

    Image ID:       

    Port:           6379/TCP

    Host Port:      0/TCP

    State:          Waiting

      Reason:       ContainerCreating

    Ready:          False

    Restart Count:  0

    Requests:

      cpu:        300m

    Environment:  <none>

    Mounts:

      /redis-master from config (rw)

      /redis-master-data from data (rw)

      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-9t8tn (ro)

Conditions:

  Type              Status

  Initialized       True 

  Ready             False 

  ContainersReady   False 

  PodScheduled      True 

Volumes:

  data:

    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)

    Medium:     

    SizeLimit:  <unset>

  config:

    Type:      ConfigMap (a volume populated by a ConfigMap)

    Name:      redis-conig

    Optional:  false

  kube-api-access-9t8tn:

    Type:                    Projected (a volume that contains injected data from multiple sources)

    TokenExpirationSeconds:  3607

    ConfigMapName:           kube-root-ca.crt

    ConfigMapOptional:       <nil>

    DownwardAPI:             true

QoS Class:                   Burstable

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    57s                default-scheduler  Successfully assigned default/redis-deployment-54cdf4f76d-x5wxs to kodekloud-control-plane

  Warning  FailedMount  25s (x7 over 56s)  kubelet            MountVolume.SetUp failed for volume "config" : configmap "redis-conig" not found


raj@jumphost ~$ kubectl get cm

NAME               DATA   AGE

kube-root-ca.crt   1      5m46s

redis-config       2      65s


raj@jumphost ~$ kubectl get deploy

NAME               READY   UP-TO-DATE   AVAILABLE   AGE

redis-deployment   0/1     1            0           97s


raj@jumphost ~$ kubectl edit deploy redis-deployment

deployment.apps/redis-deployment edited


raj@jumphost ~$ kubectl get deploy

NAME               READY   UP-TO-DATE   AVAILABLE   AGE

redis-deployment   0/1     1            0           3m37s


raj@jumphost ~$ kubectl get pod

NAME                                READY   STATUS              RESTARTS   AGE

redis-deployment-54cdf4f76d-x5wxs   0/1     ContainerCreating   0          4m12s

redis-deployment-5bcd4c7d64-94d6m   0/1     ErrImagePull        0          42s


raj@jumphost ~$ kubectl describe pod redis-deployment-5bcd4c7d64-94d6m

Name:             redis-deployment-5bcd4c7d64-94d6m

Namespace:        default

Priority:         0

Service Account:  default

Node:             kodekloud-control-plane/172.17.0.2

Start Time:       Sun, 12 Oct 2025 11:08:55 +0000

Labels:           app=redis

                  pod-template-hash=5bcd4c7d64

Annotations:      <none>

Status:           Pending

IP:               10.244.0.5

IPs:

  IP:           10.244.0.5

Controlled By:  ReplicaSet/redis-deployment-5bcd4c7d64

Containers:

  redis-container:

    Container ID:   

    Image:          redis:alpin

    Image ID:       

    Port:           6379/TCP

    Host Port:      0/TCP

    State:          Waiting

      Reason:       ImagePullBackOff

    Ready:          False

    Restart Count:  0

    Requests:

      cpu:        300m

    Environment:  <none>

    Mounts:

      /redis-master from config (rw)

      /redis-master-data from data (rw)

      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-jl9s7 (ro)

Conditions:

  Type              Status

  Initialized       True 

  Ready             False 

  ContainersReady   False 

  PodScheduled      True 

Volumes:

  data:

    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)

    Medium:     

    SizeLimit:  <unset>

  config:

    Type:      ConfigMap (a volume populated by a ConfigMap)

    Name:      redis-config

    Optional:  false

  kube-api-access-jl9s7:

    Type:                    Projected (a volume that contains injected data from multiple sources)

    TokenExpirationSeconds:  3607

    ConfigMapName:           kube-root-ca.crt

    ConfigMapOptional:       <nil>

    DownwardAPI:             true

QoS Class:                   Burstable

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  71s                default-scheduler  Successfully assigned default/redis-deployment-5bcd4c7d64-94d6m to kodekloud-control-plane

  Normal   Pulling    27s (x3 over 70s)  kubelet            Pulling image "redis:alpin"

  Warning  Failed     27s (x3 over 70s)  kubelet            Failed to pull image "redis:alpin": rpc error: code = NotFound desc = failed to pull and unpack image "docker.io/library/redis:alpin": failed to resolve reference "docker.io/library/redis:alpin": docker.io/library/redis:alpin: not found

  Warning  Failed     27s (x3 over 70s)  kubelet            Error: ErrImagePull

  Normal   BackOff    3s (x4 over 69s)   kubelet            Back-off pulling image "redis:alpin"

  Warning  Failed     3s (x4 over 69s)   kubelet            Error: ImagePullBackOff


raj@jumphost ~$ kubectl edit deploy redis-deployment

deployment.apps/redis-deployment edited


raj@jumphost ~$ kubectl get deploy

NAME               READY   UP-TO-DATE   AVAILABLE   AGE

redis-deployment   1/1     1            1           6m3s


raj@jumphost ~$ kubectl get pod

NAME                                READY   STATUS        RESTARTS   AGE

redis-deployment-54cdf4f76d-x5wxs   0/1     Terminating   0          6m10s

redis-deployment-7c8d4f6ddf-j5ngk   1/1     Running       0          15s

raj@jumphost ~$ 


Conclusion:-

In this practical DevOps tutorial, learn how to troubleshoot and fix a broken Redis deployment on a Kubernetes cluster. Follow a real-world scenario where a misconfiguration caused the Redis app to go down, and see how to identify and resolve issues like:

  • Debugging pods stuck in ContainerCreating or ImagePullBackOff
  • Analyzing kubectl describe and kubectl logs output
  • Fixing ConfigMap reference errors
  • Correcting image name typos
  • Ensuring successful pod recovery and service availability

This course is ideal for DevOps engineers, SREs, and Kubernetes practitioners who want to sharpen their troubleshooting skills in real-world environments.



No comments:

Post a Comment