Rancher¶
VTTI Rancher (requires on-campus or VPN to access)
Rancher is an open source project designed to help with the management of Kubernetes clusters and the applications and services deployed on them.
Accessing clusters via Rancher¶
Clusters you are granted acccess to will be visible within Rancher. Within a cluster, Rancher divides things into "Projects" which can encompass one or more Kubernetes namespaces. You might be given cluster level access or only access to a particular project or set of namespaces within the cluster depending on your needs.
Once you log in to Rancher via Keycloak, you should be able to see navigate to see the clusters and resources for which you are given access:

For convenience, Rancher has a built-in shell with kubectl access, which you can find in the top right corner after you've selected a cluster from the menu:

In that same area, you can find the button to download a kubeconfig file locally to run commands from your own machine:

Once downloaded, you can have kubectl use that configuration in a number of different ways. See the docs for different ways to use it, but here are a couple examples:
# Reference a kubeconfig file inline after moving it to your ~/.kube directory for convenience
kubectl --kubeconfig ~/.kube/vcluster.yaml get pods
# Set the context more permanaently for your session
kubectl config --kubeconfig=~/.kube/vcluster.yaml use-context vcluster
kubectl get pods
# Add new file into the env variable kubeconfig uses (see the files for the named contexts to use)
export KUBECONFIG=~/.kube/config:~/.kube/vcluster.yaml
kubectl --context vcluster get pods
# You can also merge the files listed in the KUBECONFIG env var into a single file
export KUBECONFIG=~/.kube/config:~/.kube/vcluster.yaml
kubectl config view --flatten > ~/.kube/config
# Now you don't have to add all of the files to the env var with every new shell, but can just rely on the ~/.kube/config file and its multiple contexts
kubectl config use-context vcluster
kubectl get pods
# Reference a kubeconfig file inline after moving it to your ~\.kube directory for convenience
kubectl --kubeconfig ~\.kube\vcluster.yaml get pods
# Set the context more permanaently for your session
kubectl config --kubeconfig=~\.kube\vcluster.yaml use-context vcluster
kubectl get pods
# Add new file into the env variable kubeconfig uses (see the files for the named contexts to use)
export KUBECONFIG=~\.kube\config:~\.kube\vcluster.yaml
kubectl --context vcluster get pods
# You can also merge the files listed in the KUBECONFIG env var into a single file
export KUBECONFIG=~\.kube\config:~\.kube\vcluster.yaml
kubectl config view --flatten > ~\.kube\config
# Now you don't have to add all of the files to the env var with every new shell, but can just rely on the ~\.kube\config file and its multiple contexts
kubectl config use-context vcluster
kubectl get pods