⚠️ Warning: Running scripts directly in the production environment can impact live users. Use this guide responsibly and with proper approvals.
This guide explains how to manually execute cron scripts inside the Kubernetes cluster for production when debugging or applying urgent fixes.
Make sure the following tools are installed and accessible:
Windows:
choco install doctlmacOS:
brew install doctlLinux:
curl -s https://api.github.com/repos/digitalocean/doctl/releases/latest \
| grep "browser_download_url.*linux-amd64.tar.gz" \
| cut -d '"' -f 4 \
| wget -i - -O doctl.tar.gz
tar -xvzf doctl.tar.gz
sudo mv doctl /usr/local/bin/Windows:
choco install kubernetes-climacOS:
brew install kubectlLinux:
sudo apt update && sudo apt install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] \
https://apt.kubernetes.io/ kubernetes-xenial main" \
| sudo tee /etc/apt/sources.list.d/kubernetes.list > /dev/null
sudo apt update
sudo apt install -y kubectlVerify Installation
doctl version
kubectl version --client✅ Make sure both
doctlandkubectlare accessible in your terminal before proceeding with preview or production deployment steps.
-
Login to DigitalOcean
- Navigate to the required DigitalOcean team (eg.
Platform,CaterPlan, etc.) - Go to API → Generate a new token
- Navigate to the required DigitalOcean team (eg.
-
Authenticate using the token:
doctl auth init --access-token <your-production-token> doctl kubernetes cluster list doctl kubernetes cluster kubeconfig save <cluster-name> kubectl get ns
-
Identify the pod where your application is running:
kubectl get pods -n <production-namespace>
-
Open a shell session in the pod:
kubectl exec -it <pod-name> -n <production-namespace> -- /bin/bash- After entering the pod, you can run scripts like:
npm run run:change-booking-appointment-status
npm run run:send-appointment-reminder- Exit the pod shell when done:
exit- Always double-check that you are in the correct production namespace.
- Only run scripts after validating the impact, ideally in preview first.
- Avoid running scripts that mutate critical state during peak traffic unless absolutely necessary.