Kubernetes stuck on ContainerCreating

Hello, I am trying to bring up wordpress with kubernets, but after creating the deployment file and deploying it, when I get the list of pods, it gets stuck in the container creating status.

NAME                    READY   STATUS              RESTARTS   AGE
mysql-c85f7f79c-99khh   0/1     ContainerCreating   0          35m

And when I use the microk8s kubectl describe pods command, it displays the following text:

Name:           mysql-c85f7f79c-99khh
Namespace:      default
Priority:       0
Node:           afra-6603-19807/31.14.115.63
Start Time:     Mon, 05 Aug 2024 10:29:12 +0330
Labels:         app=mysql
                pod-template-hash=c85f7f79c
Annotations:    <none>
Status:         Pending
IP:
IPs:            <none>
Controlled By:  ReplicaSet/mysql-c85f7f79c
Containers:
  mysql:
    Container ID:
    Image:          mysql:5.6
    Image ID:
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:
      MYSQL_ROOT_PASSWORD:  password
    Mounts:
      /var/lib/mysql from mysql-persistent-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-lvdm9 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  mysql-persistent-storage:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  mysql-pv-claim
    ReadOnly:   false
  default-token-lvdm9:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-lvdm9
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason                  Age                  From                      Message
  ----     ------                  ----                 ----                      -------
  Normal   Scheduled               35m                  default-scheduler         Successfully assigned default/mysql-c85f7f79c-99khh to afra-6603-19807
  Warning  FailedCreatePodSandBox  43s (x159 over 35m)  kubelet, afra-6603-19807  Failed to create pod sandbox: rpc error: code = Unknown desc = failed to get sandbox image "k8s.gcr.io/pause:3.1": failed to pull image "k8s.gcr.io/pause:3.1": failed to resolve image "k8s.gcr.io/pause:3.1": no available registry endpoint: unexpected status code https://k8s.gcr.io/v2/pause/manifests/3.1: 403 Forbidden

Please guide me how to get out of this situation (change container creating status to running)

The image is mysql:5.6. Most people default to using docker hub and get a “rate limit exceeded” error… so perhaps you are using a private registry and haven’t setup the imagePullSecret?


Edit: I kinda just skipped to the error out of habit. Turns out you default to k8s.gcr.io in the output. So yea, you need to setup the imagePullSecret and reference it in the pod template.