Skip to content

Kubernetes Cluster

Login Credentials

Login to cloud.linode.com with credentials stored in Bitwarden and download the kubegconfig for the indevets cluster.

Use the terminal, or a client like Lens to perform actions within the cluster.

Application Hosting

Pull Requests

Staging releases are deployed in the indevets-sandbox namespace.

Staging

Staging releases are deployed in the indevets-staging namespace.

Production

Production releases are deployed in the indevets-production namespace

Using cats-admin service account

The cats-admin service account provides access to the production application and database to run commands, open shells, view logs, and forward ports.

  1. Download the indevets-cats-admin.yaml attachment from the cats-admin @ indevets k8s secret in BitWarden into your ~/.kube directory
  2. Activate the downloaded KUBECONFIG in your current terminal session:

    export KUBECONFIG=~/.kube/indevets-cats-admin.yaml
    
  3. Switch to indevets-production namespace:

    kubectl config set-context --current --namespace=indevets-production
    
  4. Get the name of the currently running production pod and container name prefix and store them as shell variables:

    APP_POD=$(kubectl get pod -l app.kubernetes.io/name=indevets-core -o jsonpath='{.items[0].metadata.name}')
    CONTAINER_PREFIX=indevets-core-prod
    

Open interactive app shell

kubectl exec -it $APP_POD -c ${CONTAINER_PREFIX}-app -- bash

Check version

kubectl exec $APP_POD -c ${CONTAINER_PREFIX}-app -- bash -c 'echo $SOURCE_TAG'

Open interactive database shell

kubectl exec -it $APP_POD -c ${CONTAINER_PREFIX}-db -- bash -c 'psql -U${POSTGRES_USER}'

Run an artisan command

kubectl exec -it $APP_POD -c ${CONTAINER_PREFIX}-app -- artisan migrate

Run an SQL query

echo 'SELECT * FROM users' | kubectl exec -i $APP_POD -c ${CONTAINER_PREFIX}-db -- bash -c 'psql -U${POSTGRES_USER}'

Forward PostgreSQL port

kubectl port-forward pods/$APP_POD 5432:5432

Database logins

Default database credentials can be found in the respective k8s environment configs, i.e. k8s/environments/production/postgres-production.yaml for production credentials.