I wanted to execute kubectl exec
command and connect to a container, so that I can execute some commands on it. I have set the proxy with the following command:
kubectl proxy -p=8080 --kubeconfig=/directory_path/remote-kubeconfig &
proxy started running. I tried executing kubectl exec
command:
kubectl exec -it <pod> --namespace=<namespace> -c <container> -- ls -l
I got the following error:
error: unable to upgrade connection: <h3>Unauthorized</h3>
Did I missed anything while executing kubectl exec
command ?? Please help.
I got a solution for this problem but not a good one.
I issued --disable-filter
along with kubectl proxy
command. After that, I could execute kubectl exec
commands successfully.
But when I use --disable-filter
, it is prone to vulnerability. A message Request filter disabled, your proxy is vulnerable to XSRF attacks, please be cautious
is displayed with --disable-filter
.
so, I dont think that this is a good solution.
Please let me know, if any one knows better solution for this problem.