1

We are connecting to kubernetes cluster hosted in AWS. I am able to do it via cli

aws sso login --profile 234234293-prj_ns_qa_manager

#set the context to appropriate sandbox cluster

kubectl config use-context qasandbox1-qa_manager

After this i am to install helm chart in the kubernetes cluster. Also i am able to access pod via cli.

I have install vscode kubernetes extension. I am able to see the cluster and pod .When i attach vscode it opens in another session where this kubernetes context and cluster not found so it throws error as below.

[660 ms] Start: Run: kubectl exec -it my-debug-proj-cli-w7vng --context qasandbox1-qa_manager --namespace qa-manager --container proj-cli -- env VSCODE_REMOTE_CONTAINERS_SESSION=abb319e7-e9f2-4f8f-889c-b1183738e93f1753247958353 /bin/sh
[681 ms] Start: Run in container: echo $PATH
[815 ms] Shell server terminated (code: 1, signal: null)

error: context "qasandbox1-qa_manager" does not exist

How to attach to container in a pod with proper context? or is there a way to open container in the same session where i have configured context?

1 Answer 1

0

I found the answer recently , I am adding this for other's benefit

Go to Files-> Preferences -> settings -> Vs-kubernetes -> Edit in settings.json

enter image description here

add kubectl path

"vs-kubernetes.kubectl-path": "/usr/local/bin/kubectl",

I am using wsl ,so also enable below settings

enter image description here

After this I am able to attach to a pod

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.