apiVersion: apps/v1
kind: Deployment
metadata:
  name: mariadb-deployment
  labels:
    app: wordpress
    type: database
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wordpress
      type: database
  template:
    metadata:
      labels:
        app: wordpress
        type: database
    spec:
      containers:
        - name: contenedor-mariadb
          image: mariadb
          ports:
            - containerPort: 3306
              name: db-port
          env:
            - name: MYSQL_USER
              valueFrom:
                configMapKeyRef:
                  name: bd-datos
                  key: bd_user
            - name: MYSQL_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: bd-datos
                  key: bd_dbname
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: bd-passwords
                  key: bd_password
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: bd-passwords
                  key: bd_rootpassword
