Search code examples
amazon-web-serviceskuberneteskubectlrancher

kubectl exec command failing with: Upgrade request required


I have set up a Rancher k8s environment on AWS.

Rancher server lies behind a classic ELB with ssl termination and is accessible via e.g https://my.rancher.server.

I have deployed a simple pod via the command line by running

kubectl create -f <podfilename.yml>

I am then able to get and describe the pod.

However, the following command fails:

$ kubectl exec my.pod.name -- ls /app
W1219 12:13:12.053543   16174 http.go:363] Error reading backend response: unexpected EOF
error: error sending request: Post https://my.rancher.server/r/projects/1a1043/kubernetes:6443/api/v1/namespaces/default/pods/my.pod.name/exec?command=ls&command=%2Fapp&container=k8s-demo&container=k8s-demo&stderr=true&stdout=true: unexpected EOF

edit: this is the json returned:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "Upgrade request required",
  "reason": "BadRequest",
  "code": 400
}

I have configured my elb to use ssl listener, and also configured proxy protocol.

enter image description here


Solution

  • ELB's HTTP does not support websockets; you need to use a SSL listener -> TCP backend and configure proxy protocol support. http://rancher.com/docs/rancher/v1.6/en/installing-rancher/installing-server/basic-ssl-config/#elb