[Entrypoint]: Database is uninitialized and password option is not specified

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.19.5 with minikube version: v1.15.1
commit: 23f40a012abb52eff365ff99a709501a61ac5876
Cloud being used: (put bare-metal if not on a public cloud)
Installation method: Homebrew
Host OS: macOS Mojave

I am using a basic mysql container and am trying to configure most in my deployment:

- name: mysql
  image: smart48/smt-mysql:1.1
  # The default pull policy is IfNotPresent
  # When imagePullPolicy is defined without a specific value, it is also set to Always.
  imagePullPolicy: IfNotPresent
  env:
    - name: mysql_ROOT_PASSWORD
      value: .sweetpwd.
    - name: mysql_DATABASE
      value: my_db
    - name: mysql_USER
      value: db_user
    - name: mysql_PASSWORD
      value: .mypwd
  args: ["--default-authentication-plugin=mysql_native_password"]
  ports:
    - containerPort: 3306
  volumeMounts:
    - name: mysql-persistent-storage
      mountPath: /var/lib/mysql

It is not working as it seems I need to set the passwords still with this kind of setup:
Error log

kubectl logs -f app-6b8877cdd7-b74hb mysql     
2020-12-08 04:49:12+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2020-12-08 04:49:12+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-12-08 04:49:12+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2020-12-08 04:49:12+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
        You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD

The setup here does load env data however . So what am I missing here?

Testing locally now with

# https://github.com/kadnan/LearningK8s
# https://www.serverlab.ca/tutorials/containers/kubernetes/how-to-deploy-mysql-server-5-7-to-kubernetes/
- name: mysql
  image: smart48/smt-mysql:1.1
  # The default pull policy is IfNotPresent
  # When imagePullPolicy is defined without a specific value, it is also set to Always.
  imagePullPolicy: IfNotPresent
  env:
    - name: mysql_ROOT_PASSWORD
      valueFrom:
        secretKeyRef:
          name: mysql-secrets
          key: ROOT_PASSWORD
    - name: mysql_DATABASE
      valueFrom:
        secretKeyRef:
          name: mysql-secrets
          key: DATABASE
    - name: mysql_DB_USER
      valueFrom:
        secretKeyRef:
          name: mysql-secrets
          key: DB_USER
    - name: mysql_PASSWORD
      valueFrom:
        secretKeyRef:
          name: mysql-secrets
          key: PASSWORD
  args: ["--default-authentication-plugin=mysql_native_password"]
  ports:
    - containerPort: 3306
  volumeMounts:
    - name: mysql-persistent-storage
      mountPath: /var/lib/mysql

using a secret.yml file with

---
apiVersion: v1
kind: Secret
metadata:
  name: mysql-secrets
  namespace: smt-local
type: Opaque
data:
  # echo -n "my-super-secret-password" | base64
  ROOT_PASSWORD: c3VwZXItc2VjcmV0LXBhc3N3b3JkCg==
  DATABASE:
  DB_USER:
  PASSWORD:

Needed to move not base64 encoded stufff out and back into deployment:

env:
  - name: MYSQL_ROOT_PASSWORD
    valueFrom:
      secretKeyRef:
        name: mysql-secrets
        key: ROOT_PASSWORD
  - name: MYSQL_DATABASE
    value: smt-local-db
  - name: MYSQL_DB_USER
    value: database-user
  - name: MYSQL_PASSWORD
    valueFrom:
      secretKeyRef:
        name: mysql-secrets
        key: PASSWORD

Also had to apply kubectl apply -f local/secret.yml before running deployment.

Then this MySQL container started working

kubectl logs -f app-86cd676cd5-fzlsd mysql
2020-12-08 05:56:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2020-12-08 05:56:30+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-12-08 05:56:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
2020-12-08T05:56:31.434145Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2020-12-08T05:56:31.434253Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 1
2020-12-08T05:56:31.437250Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2020-12-08T05:56:31.451610Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2020-12-08T05:56:31.917045Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2020-12-08T05:56:32.104350Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2020-12-08T05:56:32.182591Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-12-08T05:56:32.182835Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2020-12-08T05:56:32.185925Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-12-08T05:56:32.214620Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.