cloud-provider-openstack icon indicating copy to clipboard operation
cloud-provider-openstack copied to clipboard

keystone URL got truncated in k8s-keystone-auth webhook and client

Open jsoyee opened this issue 8 years ago • 20 comments

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened: Hi All, then i follow the instructions setup k8s-keystone-auth webhook, the services got lunched successfully, followed by the latest version of instruction, we put client binary together with kubectl, when try to do authentication, the keystone URL got truncated. my keystone URL: https://ci22sj-keystone-srv.xxx.com/identity/v3

[root@deploy sjc02]# kubectl get all Please enter project name: PROD-Collaboration Cloud Container PaaS An error occurred: Post https://ci22sj-keystone-sr/v3/auth/tokens: dial tcp: lookup ci22sj-keystone-sr on 192.168.65.1:53: no such host Please enter project name: An error occurred: Post https://ci22sj-keystone-sr/v3/auth/tokens: dial tcp: lookup ci22sj-keystone-sr on 192.168.65.1:53: no such host Please enter project name: An error occurred: Post https://ci22sj-keystone-sr/v3/auth/tokens: dial tcp: lookup ci22sj-keystone-sr on 192.168.65.1:53: no such host Please enter project name: An error occurred: Post https://ci22sj-keystone-sr/v3/auth/tokens: dial tcp: lookup ci22sj-keystone-sr on 192.168.65.1:53: no such host

Service log [root@dfw02-rancher-cnl-etcd01 kubernetes]# kubectl --kubeconfig=kubeconfig.yaml logs service/k8s-keystone-auth-service -n kube-system Found 2 pods, using pod/k8s-keystone-auth-6457b696cd-9dmnr W0821 16:48:16.070283 1 config.go:73] Argument --sync-config-file or --sync-configmap-name missing. Data synchronization between Keystone and Kubernetes is disabled. I0821 16:48:16.070408 1 keystone.go:526] Creating kubernetes API client. W0821 16:48:16.070417 1 client_config.go:533] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work. I0821 16:48:16.079293 1 keystone.go:543] Kubernetes API client created, server version v1.11 I0821 16:48:16.182751 1 keystone.go:93] ConfigMaps synced and ready I0821 16:48:16.182799 1 keystone.go:101] Starting webhook server... I0821 16:48:16.183751 1 keystone.go:155] ConfigMap created or updated, will update the authorization policy. I0821 16:48:16.183814 1 keystone.go:171] Authorization policy updated. I0821 16:53:57.773743 1 logs.go:49] http: TLS handshake error from 10.42.0.0:48770: EOF Pod logs [root@dfw02-rancher-cnl-etcd01 kubernetes]# kubectl --kubeconfig=kubeconfig.yaml logs pod/k8s-keystone-auth-6457b696cd-7dl99 -n kube-system W0821 16:48:22.446126 1 config.go:73] Argument --sync-config-file or --sync-configmap-name missing. Data synchronization between Keystone and Kubernetes is disabled. I0821 16:48:22.446246 1 keystone.go:526] Creating kubernetes API client. W0821 16:48:22.446257 1 client_config.go:533] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work. I0821 16:48:22.468818 1 keystone.go:543] Kubernetes API client created, server version v1.11 I0821 16:48:22.571908 1 keystone.go:93] ConfigMaps synced and ready I0821 16:48:22.571990 1 keystone.go:101] Starting webhook server... I0821 16:48:22.572314 1 keystone.go:155] ConfigMap created or updated, will update the authorization policy. I0821 16:48:22.572413 1 keystone.go:171] Authorization policy updated.

[root@dfw02-rancher-cnl-etcd01 kubernetes]# kubectl --kubeconfig=kubeconfig.yaml logs pod/k8s-keystone-auth-6457b696cd-9dmnr -n kube-system W0821 16:48:16.070283 1 config.go:73] Argument --sync-config-file or --sync-configmap-name missing. Data synchronization between Keystone and Kubernetes is disabled. I0821 16:48:16.070408 1 keystone.go:526] Creating kubernetes API client. W0821 16:48:16.070417 1 client_config.go:533] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work. I0821 16:48:16.079293 1 keystone.go:543] Kubernetes API client created, server version v1.11 I0821 16:48:16.182751 1 keystone.go:93] ConfigMaps synced and ready I0821 16:48:16.182799 1 keystone.go:101] Starting webhook server... I0821 16:48:16.183751 1 keystone.go:155] ConfigMap created or updated, will update the authorization policy. I0821 16:48:16.183814 1 keystone.go:171] Authorization policy updated.

What you expected to happen: there should be some logs printed saying if there are some problem this webhook is facing.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • openstack-cloud-controller-manager version: [root@dfw02-rancher-cnl-etcd01 kubernetes]# kubectl --kubeconfig=kubeconfig.yaml version Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:43:26Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} [root@dfw02-rancher-cnl-etcd01 kubernetes]# image: k8scloudprovider/k8s-keystone-auth

  • OS (e.g. from /etc/os-release): [root@dfw02-rancher-cnl-etcd01 ~]# cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@dfw02-rancher-cnl-etcd01 ~]#

  • Kernel (e.g. uname -a): [root@dfw02-rancher-cnl-etcd01 ~]# uname -a Linux dfw02-rancher-cnl-etcd01 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

  • Install tools: Rancher2.0.7

  • Others:

jsoyee avatar Aug 21 '18 17:08 jsoyee

@jsoyee Hi, I tested again according to the doc, everything is ok for me. I also wrote a script that automatically install k8s-keystone-service and modify api server configuration1 that may help you. From the log I didn't see there is any error, so please check you can access to the cluster ip of the k8s-keystone service.

lingxiankong avatar Aug 21 '18 22:08 lingxiankong

@lingxiankong thanks for your reply, yes, i went through the document as well, nothing response me when i try to do post request validation, but give me Error500 when i want to quick check the service. again, no error logs on the docker side when i was doing so. any instructions for how to troubleshooting this? [root@centos-57cc98cd6c-j7dtt /]# curl -i -k https://10.43.16.244:8443/webhook HTTP/1.1 500 Internal Server Error Content-Type: text/plain; charset=utf-8 X-Content-Type-Options: nosniff Date: Thu, 23 Aug 2018 02:58:04 GMT Content-Length: 4

EOF

jsoyee avatar Aug 23 '18 03:08 jsoyee

@lingxiankong , the binary seems running well. no sure if we logging somewhere i don't know. not very helpful when i navigate the containers running as busybox. /bin # ps -ef|grep keystone 1 root 0:00 ./bin/k8s-keystone-auth --tls-cert-file /etc/kubernetes/pki/cert-file --tls-private-key-file /etc/kubernetes/pki/key-file --policy-configmap-name k8s-auth-policy --keystone-url https://ci22sj-keystone-srv.webex.com:443/v3 28 root 0:00 grep keystone /bin #

jsoyee avatar Aug 23 '18 03:08 jsoyee

Is 10.43.16.244 your k8-keystone-service cluster IP? Were you sending request to that IP on the k8s nodes(either master or worker)?

lingxiankong avatar Aug 23 '18 03:08 lingxiankong

Hi @lingxiankong , yes, it is my service cluster IP, i am sending request from one centos i booted in kube-system namespace. YIZH2-M-W0QF:.kube yizh2$ kubectl --kubeconfig=kconf_clusteradmin_sj get service -n kube-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE centos ClusterIP None 42/TCP 30m k8s-keystone-auth-service ClusterIP 10.43.16.244 8443/TCP 33m kube-dns ClusterIP 10.43.0.10 53/UDP,53/TCP 2h metrics-server ClusterIP 10.43.99.61 443/TCP 2h YIZH2-M-W0QF:.kube yizh2$

jsoyee avatar Aug 23 '18 03:08 jsoyee

Could you please try to send request from within the k8s master node? BTW, I'm available in the next 1 hour in #sig-openstack channel in Kubernetes slack, we could have a chat there if it's convinient for you.

lingxiankong avatar Aug 23 '18 03:08 lingxiankong

Thanks for the offering @lingxiankong , i tried post request from K8s master node, same result as no response and log generated. if you can help build debug image, i can try that very quick, we just need more visibility about how the service react in my case . i am not fluent Slack user, will try to find you there.

jsoyee avatar Aug 23 '18 04:08 jsoyee

see update in title and detail. @lingxiankong

jsoyee avatar Aug 25 '18 01:08 jsoyee

@jsoyee seems like it's related to client-keystone-auth binary.

we put client binary together with kubectl, when try to do authentication, the keystone URL got truncated. my keystone URL: https://ci22sj-keystone-srv.xxx.com/identity/v3 [root@deploy sjc02]# kubectl get all Please enter project name: PROD-Collaboration Cloud Container PaaS An error occurred: Post https://ci22sj-keystone-sr/v3/auth/tokens: dial tcp: lookup ci22sj-keystone-sr on 192.168.65.1:53: no such host

and I'm a little confused. Last time, from your description, the problem was happening when you sent request to the webhook service directly rather than using kubectl(with client-keystone-auth binary), is that still a problem?

lingxiankong avatar Aug 26 '18 12:08 lingxiankong

@lingxiankong , thanks for reply, sorry for the confusion, i cleaned up webhook with fresh install, the original issue seems like on webhook server side was gone, we can pass authentication when directly test keystone interactions inside container. now when we test the last mile on client side, seems like the binary have some problem to deal with keystone URL like "-srv.xxx.com/identity/v3", looks like the logic looking for "v" as version information. since client and webhook server side would share same SDK underneath, i would think webhook side may also have same problem.

jsoyee avatar Aug 26 '18 16:08 jsoyee

@jsoyee hi, are the xxx in your keystone URL the numbers?

lingxiankong avatar Aug 27 '18 11:08 lingxiankong

@lingxiankong , thanks for following this up, no, it is normal domain name.

jsoyee avatar Aug 27 '18 15:08 jsoyee

talked with @jsoyee, this is a bug in gophercloud, he will prepare a bug report, so we could close this one.

lingxiankong avatar Aug 27 '18 22:08 lingxiankong

@lingxiankong we should probably keep this open so we remember to update gophercloud as soon as the change there gets fixed.

dims avatar Aug 28 '18 00:08 dims

@dims Joe Topjian indicated in gophercloud route that the fix already in their July release, Are you or @lingxiankong able to coordinate the upgrade on cloud-provider-openstack? https://github.com/gophercloud/gophercloud/commit/21d13e9de69ccd9d416580fee37c9231d21bec17#diff-c403b4cbe21c6d23ae173685665e8206

jsoyee avatar Aug 28 '18 04:08 jsoyee

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Nov 26 '18 04:11 fejta-bot

We are now using master branch of gophercloud according to the Gopkg.toml, so this issue could be closed. @jsoyee could you please double check this issue has been fixed in your environment? Please use the official docker image(k8scloudprovider/k8s-keystone-auth/) for the k8s-keystone-auth binary.

lingxiankong avatar Dec 03 '18 06:12 lingxiankong

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar Jan 02 '19 06:01 fejta-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Feb 01 '19 07:02 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Feb 01 '19 07:02 k8s-ci-robot