0
respostas

Erro ao subir do deployment do db-noticias

Olá, tudo bem?

Estou recebendo o erro do config do banco depois de alterar meu db-noticias para o deployment.

PDOException Object ( [message:protected] => SQLSTATE[HY000] [2002] No such file or directory [string:Exception:private] => [code:protected] => 2002 [file:protected] => /var/www/html/funcoes.php [line:protected] => 7 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/html/funcoes.php [line] => 7 [function] => __construct [class] => PDO [type] => -> [args] => Array ( [0] => mysql:host=;dbname= [1] => [2] => ) ) [1] => Array ( [file] => /var/www/html/index.php [line] => 6 [args] => Array ( [0] => /var/www/html/funcoes.php ) [function] => include ) ) [previous:Exception:private] => [errorInfo] => )

O meu arquivo de deployment está assim:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: db-noticias-deployment
spec:
  template:
    metadata:
      name: db-noticias
      labels:
        app: db-noticias
    spec:
      containers:
        - name: db-noticias
          image: aluracursos/mysql-db:1
          resources:
            limits:
              memory: "512Mi"
              cpu: "500m"
          ports:
            - containerPort: 3306
          envFrom:
            - configMapRef:
                name: db-configmap
  selector:
    matchLabels:
      app: db-noticias

E o do pod:

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