kubectl error: cannot add key dashboard.yaml, another key by that name already exists

The question answered user P.... on Stack Overflow I will post it here, just in case someone needs it.

The $CERT_FILE and $KEY_FILE variables are used in the setup.sh in the same directory I run the script to update the certificates. These were not set as system variables, thus both returned empty value. Since I already have the dashboard.yaml in the same directory, thus I received the error. (original answer here https://stackoverflow.com/questions/67893285/kubectl-error-cannot-add-key-dashboard-yaml-another-key-by-that-name-already-e)