Connecting to a Cell's Toolbox Pod
This guide covers how to connect to a cell’s toolbox pod for debugging and troubleshooting purposes.
Prerequisites
Section titled “Prerequisites”For GCP Cells
Section titled “For GCP Cells”Before connecting to a toolbox pod, you need:
-
PAM access to the cell’s GCP project - Follow the breakglass access guide to request the appropriate level of access:
- Use
project_readfor read-only investigation - Use
project_adminfor write access - Use
project_breakglassduring incidents with low team availability
- Use
-
Cluster credentials - Once PAM access is granted, get the cluster credentials:
Terminal window TENANT_ID="<tenant_id>"gcloud container clusters get-credentials ${TENANT_ID} \--region us-east1 \--project cell-${TENANT_ID}This will update your kubeconfig and set the current context to the cell’s cluster.
For AWS Cells
Section titled “For AWS Cells”-
Login to Hub Account - Run
assume-env-local.shin the AMP projectTerminal window AMP_ENVIRONMENT=<environment>;eval "$(./scripts/assume-env-local.sh "${AMP_ENVIRONMENT}")"This will open a prompt to sign-in using SSO, select
Confirm and continueand thenAllow access. -
Assume role - Run
assume-tenant-admin-operator.shto assumededicated/GitLabTenantAdminOperatorRoleIAM role in the target tenant accountTerminal window eval $(./scripts/assume-tenant-admin-operator.sh <TENANT_ACCOUNT_ID>) -
Cluster credentials - update kubeconfig with the credentials using the
TENANT_IDTerminal window aws eks update-kubeconfig --region us-east-1 --name <TENANT_ID>
Connecting to the Toolbox Pod
Section titled “Connecting to the Toolbox Pod”Find the Toolbox Pod
Section titled “Find the Toolbox Pod”List the toolbox pods in the default namespace:
kubectl get pods -l app=toolboxExample output:
NAME READY STATUS RESTARTS AGEgitlab-toolbox-8c6bff946-8lt4v 1/1 Running 0 5dExecute a Shell in the Toolbox Pod
Section titled “Execute a Shell in the Toolbox Pod”Execute a bash shell in the toolbox container:
kubectl exec -it <toolbox-pod-name> --container toolbox -- bashExample:
kubectl exec -it gitlab-toolbox-8c6bff946-8lt4v --container toolbox -- bashYou should now have a shell inside the toolbox pod:
git@gitlab-toolbox-8c6bff946-8lt4v:/$Common Operations
Section titled “Common Operations”Check Migration Status
Section titled “Check Migration Status”View the status of all database migrations:
gitlab-rails db:migrate:statusFilter for specific migrations:
gitlab-rails db:migrate:status | grep -E '<migration_version>'Run Migrations Manually
Section titled “Run Migrations Manually”Use the db-migrate script to execute migrations in the correct order (regular migrations first,
then post-deployment migrations):
./scripts/db-migrateThis script will:
- Check if migrations are up-to-date
- Run regular migrations (
db:migrate) - Run post-deployment migrations
- Perform custom instance setup
Troubleshooting
Section titled “Troubleshooting”Cluster Not Running Warning
Section titled “Cluster Not Running Warning”If you see a warning that the cluster is not running:
WARNING: cluster c01j98xncnbxvaqayp is not RUNNING. The kubernetes API may or may not be available.This may indicate the cluster is being upgraded or is in maintenance. Check the cluster status in the GCP/AWS console or wait for the operation to complete.
No Toolbox Pods Found
Section titled “No Toolbox Pods Found”If no toolbox pods are found, check:
- You’re in the correct namespace (default is
default) - The toolbox deployment exists:
kubectl get deployments -l app=toolbox - Check for any deployment issues:
kubectl describe deployment <toolbox-deployment>