Automation Suite: How To Enable kubectl Environment Variable In Linux Machine?

How to enable kubectl environment variable in Linux machine while using Automation Suite?

  1. Login to one of your Automation Suite Nodes.
  2. Type ls -lrta this will show all the hidden files

  1. Edit the .bash_profile and .bashrc file one by one in vi editor, and add an entry of the export command as below:
  • export KUBECONFIG="/etc/rancher/rke2/rke2.yaml" && export PATH="$PATH:/usr/local/bin:/var/lib/rancher/rke2/bin"
.bash_profile

.bashrc

  1. Save the file.
  2. Run the below commands which will preserve the current Shell's environment variables.

source ~/.bash_profile

source ~/.bashrc

  1. Execute kubectl commands without running the export command when a session closes.

Note: This is per profile basis, for example set in root is for root profile only. For any other profiles, mention the same in other profiles as well.