1
resposta

[Bug] Pod db-noticias reiniciando frequentemente

Olá, estou tentando rodar o pod db-noticias mas após o apply ele começa a crashar e reiniciar diversas vezes. Rodando kubectl get pods --watch tenho o seguinte output:

problema

Saída do kubectl describe pod db-noticias:

Name:             db-noticias
Namespace:        default
Priority:         0
Service Account:  default
Node:             docker-desktop/192.168.65.4
Start Time:       Fri, 24 Mar 2023 10:02:42 -0400
Labels:           app=db-noticias
Annotations:      <none>
Status:           Running
IP:               10.1.0.19
IPs:
  IP:  10.1.0.19
Containers:
  db-noticias-container:
    Container ID:   docker://288a5a575df22f7d405e72ececf83999edfd141d942a53b98296bbbe9dfb7519
    Image:          aluracursos/mysql-db:1
    Image ID:       docker-pullable://aluracursos/mysql-db@sha256:950ccdfe67553da34946fa7a9f938e50ab9727ebed37b43a0307421df1398c09
    Port:           3306/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       OOMKilled
      Exit Code:    1
      Started:      Fri, 24 Mar 2023 10:29:35 -0400
      Finished:     Fri, 24 Mar 2023 10:30:12 -0400
    Ready:          False
    Restart Count:  9
    Limits:
      cpu:     500m
      memory:  128Mi
    Requests:
      cpu:     500m
      memory:  128Mi
    Environment Variables from:
      db-configmap  ConfigMap  Optional: false
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-khgkv (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-khgkv:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Guaranteed
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  31m                  default-scheduler  Successfully assigned default/db-noticias to docker-desktop
  Normal   Pulled     27m (x5 over 31m)    kubelet            Container image "aluracursos/mysql-db:1" already present on machine
  Normal   Created    27m (x5 over 31m)    kubelet            Created container db-noticias-container
  Normal   Started    27m (x5 over 31m)    kubelet            Started container db-noticias-container
  Warning  BackOff    71s (x111 over 30m)  kubelet            Back-off restarting failed container

Este é o YAML do db-noticias:

apiVersion: v1
kind: Pod
metadata:
  name: db-noticias
  labels:
    app: db-noticias
spec:
  containers:
  - name: db-noticias-container
    image: aluracursos/mysql-db:1
    resources:
      limits:
        memory: "128Mi"
        cpu: "500m"
    ports:
      - containerPort: 3306
    envFrom:
      - configMapRef:
          name: db-configmap

E o configmap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: db-configmap
data:
  MYSQL_ROOT_PASSWORD: q1w2e3r4
  MYSQL_DATABASE: empresa
  MYSQL_PASSWORD: q1w2e3r4

O que pode estar acontecendo?

1 resposta

O mesmo problema aqui tbm!