VSCode Bridge to (EKS) kubernetes

Danny CrastoDanny Crasto
1 min read

Getting bridge to kubernetes to work with AWS's EKS needs some fussin'.

If you are authorized via SSO, managed by aws-vault this should help.

You need to have the aws-vault exec <profile> loaded before running k-creds. Relevant AWS environment variables are written to ~/.envs_temp which is rigged to be automatically loaded in new (ZSH) shells' that will be available to VSCode.

You should now be able to see nodes in your cluster.

function k-creds () {                                                                                                                                                            
    RC_FILE="${RC_FILE:-~/.zshrc}"                                                                                                                                                
    DEV_PROFILE="${DEV_PROFILE:-dev-profile}"                                                                                                                             

    # load                                                                                                                                                                           
    grep -q envs_temp $RC_FILE || (echo "[ -f ~/.envs_temp ] && source ~/.envs_temp" >> $RC_FILE; echo "Updated $RC_FILE")
    aws-vault export $DEV_PROFILE | sed 's/^/export /' > ~/.envs_temp && echo "Got AWS '$DEV_PROFILE' credentials, please restart vs-code"                                     
}
0
Subscribe to my newsletter

Read articles from Danny Crasto directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Danny Crasto
Danny Crasto

I am developer/code-reviewer/debugger/bug-fixer/architect/teacher/builder from dubai, uae