Login to Kubernetes clusters
Users can now login to cloud clusters with the help of Odin via using one single command.
Prerequisites
To enable the login using Odin, user needs to maintain the following;
Odin version 1.4.1 and above is required for this to work. Please use
brew install dream11/tools/odin
to upgrade to Odin's latest version.User needs to install Kubernetes plugin to login to Kubernetes clusters. The steps to install the same can be found here - Github Documentation for installing kubernetes plugin.
Steps to login to kubernetes clusters
Step 1: Obtain Cluster Name:
Users need to know the cluster name that they are looking to login to.
For each environment created by the users, there is an associated cluster which can be obtained by running the commands below.
// Describe environment to get the attached cluster name
odin describe env --name Your-Env-Name
Once the above command is executed, users can find the cluster name under "cluster" variable in the output.

Step 2: Use cluster name from above step to login to cluster
Once the cluster name is obtained, user can login by using the following command. Please note, to obtain the cluster name and execute this command, users must follow the Prerequisites.
// Command to login to the cluster
kubectl login Your-Cluster-Name
Run this for .bashrc
if ! grep -q 'k8slogin() {' ~/.bashrc; then
echo 'k8slogin() {
cluster=$(odin describe env "--name" "$1" | grep cluster | awk '\''{print $2}'\'')
kubectl login $cluster
}' >> ~/.bashrc
fi
Run this for .zshrc
if ! grep -q 'k8slogin() {' ~/.zshrc; then
echo 'k8slogin() {
cluster=$(odin describe env "--name" "$1" | grep cluster | awk '\''{print $2}'\'')
kubectl login $cluster
}' >> ~/.zshrc
fi
Post this you can simply run
k8slogin Your-Env-Name
Last updated