Skip to content

Connecting to a Cell's Toolbox Pod

This guide covers how to connect to a cell’s toolbox pod for debugging and troubleshooting purposes.

Before connecting to a toolbox pod, you need:

  1. PAM access to the cell’s GCP project - Follow the breakglass access guide to request the appropriate level of access:

  2. 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.

  1. Login to Hub Account - Run assume-env-local.sh in the AMP project

    Terminal 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 continue and then Allow access.

  2. Assume role - Run assume-tenant-admin-operator.sh to assume dedicated/GitLabTenantAdminOperatorRole IAM role in the target tenant account

    Terminal window
    eval $(./scripts/assume-tenant-admin-operator.sh <TENANT_ACCOUNT_ID>)
  3. Cluster credentials - update kubeconfig with the credentials using the TENANT_ID

    Terminal window
    aws eks update-kubeconfig --region us-east-1 --name <TENANT_ID>

List the toolbox pods in the default namespace:

Terminal window
kubectl get pods -l app=toolbox

Example output:

NAME READY STATUS RESTARTS AGE
gitlab-toolbox-8c6bff946-8lt4v 1/1 Running 0 5d

Execute a bash shell in the toolbox container:

Terminal window
kubectl exec -it <toolbox-pod-name> --container toolbox -- bash

Example:

Terminal window
kubectl exec -it gitlab-toolbox-8c6bff946-8lt4v --container toolbox -- bash

You should now have a shell inside the toolbox pod:

git@gitlab-toolbox-8c6bff946-8lt4v:/$

View the status of all database migrations:

Terminal window
gitlab-rails db:migrate:status

Filter for specific migrations:

Terminal window
gitlab-rails db:migrate:status | grep -E '<migration_version>'

Use the db-migrate script to execute migrations in the correct order (regular migrations first, then post-deployment migrations):

Terminal window
./scripts/db-migrate

This script will:

  • Check if migrations are up-to-date
  • Run regular migrations (db:migrate)
  • Run post-deployment migrations
  • Perform custom instance setup

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.

If no toolbox pods are found, check:

  1. You’re in the correct namespace (default is default)
  2. The toolbox deployment exists: kubectl get deployments -l app=toolbox
  3. Check for any deployment issues: kubectl describe deployment <toolbox-deployment>