How to enable kubectl environment variable in Linux machine while using Automation Suite?
- Login to one of your Automation Suite Nodes.
- Type ls -lrta this will show all the hidden files
- 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
- Save the file.
- Run the below commands which will preserve the current Shell's environment variables.
source ~/.bash_profile
source ~/.bashrc
- 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.