Anterior-IaC/snipeit/mariadb/secret-setup.sh
2025-02-23 15:24:32 -06:00

21 lines
515 B
Bash
Executable File

#!/bin/bash
# Prompt user for MariaDB root password
read -sp "Enter MariaDB root password: " ROOT_PASSWORD
echo ""
# Ensure the password is not empty
if [[ -z "$ROOT_PASSWORD" ]]; then
echo "Error: Password cannot be empty."
exit 1
fi
# Define namespace
NAMESPACE="snipeit"
# Create the Kubernetes secret
kubectl create secret generic mariadb-secret \
--from-literal=root-password="$ROOT_PASSWORD" \
--namespace="$NAMESPACE"
echo "✅ MariaDB secret created successfully in namespace '$NAMESPACE'."