Skip to content

kubernetes

Dann edited this page Oct 16, 2020 · 1 revision

Setting up kubectl

This wiki assumes you have kubectl setup already, if you don't contact a member of the Applications and Integrations team to get setup

Each deployment gets put into it's own namespace, if you were working with the migration deployment, as we are below, you'd want to switch to the migration namespace

kubens scholarsphere-migration

Getting a rails console

  1. Get the pod name(s) of the rails application.
kubectl get pods -l app.kubernetes.io/name=scholarsphere
NAME                                       READY   STATUS    RESTARTS   AGE
scholarsphere-migration-78f645dd68-4lngr   1/1     Running   0          124m
scholarsphere-migration-78f645dd68-5bn6n   1/1     Running   0          125m
  1. "Pop a shell"
kubectl exec -it scholarsphere-migration-78f645dd68-4lngr -- /app/bin/vaultshell

as a one-liner copy and paste

kubectl exec -it $(kubectl get pods -l app.kubernetes.io/name=scholarsphere -o custom-columns=NAME:.metadata.name --no-headers) -- /app/bin/vaultshell
  1. Run rails console, or whatever else you'd like to do
bundle exec rails c

connecting to solr

sometimes you may want to connect to solr directly. solr uses authentication, and the username and password are randomly generated.

  1. Get the solr pod name
kubectl get pods -l app.kubernetes.io/name=solr 

2.) Grab the username and password from the environment

kubectl exec scholarsphere-migration-solr-0 -- /usr/bin/env | grep -E "SOLR_USERNAME|SOLR_PASSWORD"

3.) port-forward solr to localhost

kubectl port-forward scholarsphere-migration-solr-0 8983:8983
Clone this wiki locally