Odin
  • Introduction
  • Why Odin?
  • Key Concepts
    • Environment
      • Environment Type
    • Provisioning
      • Provisioning Config for Component Types
    • Component
      • Available Component Types
      • Component Type reference
        • Optimus Components
          • Aerospike [6.3.0.7-1.0.0]
    • Service
      • Know Your Service Definition
    • Versioning
      • Clearing the Confusion: A Simplified Guide to Artifact, Component, and Service Versions
    • Service Sets
    • Labels
  • Reference
    • CLI reference
  • Onboard Your Service
    • Installation
    • Configure
    • Odin -h
    • Getting Started
    • Create Environment
      • Operations on Environment
    • Service Definition
    • Provisioning Config
    • Deploy Service
    • Release Service
    • Optimus Datastore Operations
      • How to use Optimus Datastore in my service?
      • RDS Operations
      • Aerospike Operations
      • Kafka Operations
    • Operating Service & Components
      • Redeploy
        • In Place Deployment
        • Blue Green Deployment
      • Rolling Restart
      • Adding & removing components
      • Revert a deployment for application component
      • Downscaling a Passive Stack
      • Updating the no. of stacks of application component
    • Dev <> QA iteration
    • Frequently Asked Questions
    • Deploy Concrete Service
    • Undeploy Service
    • Delete Environment
    • Appendix
  • How To
    • Define error threshold for canary deployment
    • Add or Remove a component in an already deployed service
    • Integrate mono-repo(cronjobs) with Odin
    • Deploy crontab with Odin
    • Integrate Data pipeline with Odin
    • Push logs to log central
    • Build artifacts for multi module applications
    • Load test with Odin
    • Track Deployments against Commit Ids
    • Deploy Service on Production - Dream11
    • How and when images are created
    • Check logs for deployed infrastructure - Dream11
    • Onboard Stepfunction as a component
    • Onboard Serverless as a component
    • Login to Kubernetes clusters
  • Release Notes
    • 1.2.0-beta.2 - 11 August, 2022
    • Odin October Release
    • Odin 1.2.0 - Nov 9th 2022
    • Odin February Release
Powered by GitBook
On this page
  • Prerequisites
  • Steps to login to kubernetes clusters
Export as PDF
  1. How To

Login to Kubernetes clusters

PreviousOnboard Serverless as a componentNext1.2.0-beta.2 - 11 August, 2022

Last updated 11 months ago

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;

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

  2. User needs to install Kubernetes plugin to login to Kubernetes clusters. The steps to install the same can be found here - .

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.

Pro tip: Run this command to get cluster name directly

odin describe env --name rush-d11 | grep cluster | awk '{print $2}'

Step 2: Use cluster name from above step to login to cluster

// Command to login to the cluster

kubectl login Your-Cluster-Name

Pro tip: Add this in your .bashrc/.zshrc to alias and automate the complete process and

source .bashrc/.zshrc


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

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
Github Documentation for installing kubernetes plugin
Sample field details for the Cluster Name