telepresence icon indicating copy to clipboard operation
telepresence copied to clipboard

telepresence: error: connector.Connect: kubeconfig has no context definition

Open mehdihadeli opened this issue 2 years ago • 2 comments

Hi, I get this error when I run telepresence connect command in the windows!

telepresence: error: connector.Connect: kubeconfig has no context definition

What is the problem?

mehdihadeli avatar Jul 16 '22 14:07 mehdihadeli

I also encountered this problem! and when I use the command it is ok! You can specify the address of the k8s config file through the Kubeconfig parameter

sudo telepresence --kubeconfig=/home/liuxu/.kube/config connect

liuxuzxx avatar Aug 25 '22 08:08 liuxuzxx

However, I didn't need to specify the kubeconfig parameter when I used it before

liuxuzxx avatar Aug 25 '22 08:08 liuxuzxx

I'm using Debian 11 with telepresence 2.9.4, I'm facing the same issue.

$ telepresence connect 
telepresence connect: error: connection error: desc = "transport: error while dialing: dial unix /var/run/telepresence-daemon.socket: connect: connection refused" (socket rm failed with remove /var/run/telepresence-daemon.socket: permission denied); this usually means that the process has terminated ungracefully
If you think you have encountered a bug, please run `telepresence gather-logs` and attach the telepresence_logs.zip to your github issue or create a new one: https://github.com/telepresenceio/telepresence/issues/new?template=Bug_report.md .

If I use sudo the telepresence will not found the /root/.kube/config... and if I force the kubeconfig of my user, I will get another error because aws-cli (my kubeconfig is using aws cli to obtain the AWS EKS token).

I just get this working after copying my ./aws/credentails and .kube/config to /root/.

This isn't a good approch, sharing my kubeconfig and aws credentials in my root user.

betonetotbo avatar Dec 06 '22 14:12 betonetotbo

The executable telepresence serves as both a CLI client and a daemon.

When you run the command telepresence connect as CLI client, it detects whether there is a telepresence daemon. If the daemon exists, the client delegates the "connect" task to the daemon. If the daemon doesn't exist, the client starts a daemon and delegates the task to it.

If you run telepresence as some user for the 1st time, and run telepresence as another user for the 2nd time, the task of the 2nd run will be executed as the user of the 1st run.

So your solution is simply sudo killall telepresence and then telepresence connect again.

zimtsui avatar Mar 13 '23 13:03 zimtsui

I would strongly recommend using telepresence quit -s instead of sudo killall.

Like kubectl, telepresence will need a valid kubeconfig. Store the config at the default location, use a KUBECONFIG environment variable, or use --kubeconfig, all of them works.

Closing this ticket.

thallgren avatar Mar 13 '23 14:03 thallgren