error: error upgrading connection: Upgrade request required when using telepresence debug pod

2/20/2020

when I start telepresence(v0.104) to debug remote kubernetes(v1.15.2) pod:

telepresence

when execute to this command:

kubectl --context default --namespace dabai-fat port-forward telepresence-1582172593-3845718-23919-6d665f6cbc-9wvq5 51694:8022

it shows this error:

Recent output was:
  error: error upgrading connection: Upgrade request required

Here are the last few lines of the logfile (see /Users/dolphin/.kube/telepresence.log for the complete logs):

   6.7 TEL | END SPAN remote.py:142(get_remote_info)    2.6s
   6.7 TEL | BEGIN SPAN connect.py:37(connect)
   6.7 TEL | [18] Launching kubectl logs: kubectl --context default --namespace dabai-fat logs -f telepresence-1582172593-3845718-23919-6d665f6cbc-9wvq5 --container telepresence-1582172593-3845718-23919 --tail=10
   6.7 TEL | [19] Launching kubectl port-forward: kubectl --context default --namespace dabai-fat port-forward telepresence-1582172593-3845718-23919-6d665f6cbc-9wvq5 51694:8022
   6.7 TEL | [20] Running: ssh -F /dev/null -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -q -p 51694 telepresence@127.0.0.1 /bin/true
   6.7 TEL | [20] exit 255 in 0.01 secs.
   7.0 TEL | [21] Running: ssh -F /dev/null -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -q -p 51694 telepresence@127.0.0.1 /bin/true
   7.0 TEL | [21] exit 255 in 0.01 secs.
   7.3  19 | error: error upgrading connection: Upgrade request required
   7.3 TEL | [19] kubectl port-forward: exit 1
   7.3 TEL | [22] Running: ssh -F /dev/null -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -q -p 51694 telepresence@127.0.0.1 /bin/true
   7.3 TEL | [22] exit 255 in 0.01 secs.

I think the key is the port forward failed.This is my nginx config:

server{
    listen 443 ssl;

    ssl_certificate /etc/nginx/conf.d/cert/example.com/fullchain1.pem;
    ssl_certificate_key /etc/nginx/conf.d/cert/example.com/privkey1.pem;

    access_log /nginx-access.log;
    error_log /nginx-error.log;

    server_name k8s-ctl.example.com;

    location / {
        client_max_body_size 50m;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://172.19.104.231:8443;
        index index.html index.htm;
    }
}

where is the problem and what should I do to make it right?

-- Dolphin
kubernetes

1 Answer

3/14/2020

If you using domain to access your cluster,try to change using IP:PORT to access the remote cluster,I change to this way fix error upgrading connection: Upgrade request required.The ~/.kube/config like this:

clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://42.11.108.214:8443
  name: default
-- Dolphin
Source: StackOverflow