origin icon indicating copy to clipboard operation
origin copied to clipboard

oc exec failing on containerized openshift

Open allen13 opened this issue 10 years ago • 11 comments

When attempting to exec or rsh into a container I receive: error: unable to upgrade connection: Forbidden (user=system:anonymous, verb=proxy, namespace=, resource=nodes)

Additionally the web console exec terminal also displays: Could not connect to the container. Do you have sufficient privileges?

The same thing applies to docker logs as well.

Version

oc v1.1.4 kubernetes v1.2.0-origin-41-g91d3e75 base OS: fedora atomic 4.4.3-300.fc23.x86_64 master server container: openshift/origin:v1.1.4 node container: openshift/origin:v1.1.4

Additional Information

oc whoami = system:admin

The node server logs claim I am unauthenticated: node_auth.go:142] Node request attributes: namespace=, user=system:anonymous, groups=[system:unauthenticated]

allen13 avatar Mar 15 '16 20:03 allen13

I've been pouring through the openshift/kubernetes code trying to trace out the path of execution. Any insights into this would be a great help! Thanks!

What I understand so far: oc --config=/root/.kube/config exec ... > builds and sends api request > presumably hits the apiserver?? > loses authentication somewhere along the way > hits the kubelet node api server > no authentication so it throws error

allen13 avatar Mar 16 '16 01:03 allen13

@ncdc fyi

soltysh avatar Mar 16 '16 09:03 soltysh

I am not able to reproduce locally. Could you please provide more information about how you deployed containerized?

Also, could you please provide a gist of oc exec when it fails, with --loglevel=8?

ncdc avatar Mar 16 '16 10:03 ncdc

Thanks for recommending --loglevel=8, it returns a lot of great info! Here is the gist: https://gist.github.com/allen13/68d4d20cfb621bdb05d4

Additionally here is the playbook I am using to spin up the containerized openshift: https://github.com/allen13/kube-cloud . Let me know if you need any other info. I will be continuing to work this problem until it is solved.

allen13 avatar Mar 16 '16 14:03 allen13

@allen13 you originally filed this as being unable to run oc exec, yet the gist you pasted is for oc logs?

ncdc avatar Mar 16 '16 14:03 ncdc

Sorry, good point. Here are the logs for exec: https://gist.github.com/allen13/f774303cc8ac73405a5f

allen13 avatar Mar 16 '16 14:03 allen13

@allen13 could you please gist the logs from the master?

ncdc avatar Mar 16 '16 14:03 ncdc

The openshift-master logs had no noticeable reaction to the command being run. The node did have an error response: https://gist.github.com/allen13/2864b4f49e6baa06c03a

allen13 avatar Mar 16 '16 14:03 allen13

Have tried multiple config changes including using the default configs that the openshift start command generates. Have also tried switching from fedorda23/atomic-host to centos/atomic-host. I've also looked through a great deal of openshift and kubernetes code and I have narrowed it down to the auth exchange between the api server and the node server. The api server proxies to the node server using kubletclient but for some reason it isn't communicating the auth credentials that were passed to the api server. Any clues or help would be greatly appreciated.

allen13 avatar Mar 17 '16 19:03 allen13

Can you use curl with the ca, client cert and key referenced in the master config to hit the same URL?

curl -vvv --cacert … --cert … --key … https://…:10250/...

liggitt avatar Mar 17 '16 21:03 liggitt

After searching through every config I was able to narrow it down to the node config. I used the wrong cert for clientCA. I used the node.crt instead of a ca.crt. Thanks for the suggestions @ncdc and @liggitt , they definitely helped me narrow down the issue!

allen13 avatar Mar 18 '16 20:03 allen13