-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detail Document Needed to Setup consul-registration-hook #48
Comments
[myhost:/home/users/ashishrajshek/consul-registration-hook/cmd/consul-registration-hook]$ export KUBERNETES_SERVICE_HOST=10.73.28.78 |
Are You running this command from inside of the running POD? In https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ |
Hi Oskar, Thanks for your quick response. Let me check via POD and get back. |
What is the value I should be passing in GS_URL, KUBERNETES_POD_NAME, KUBERNETES_POD_NAMESPACE and HOST_IP in below yaml file. apiVersion: v1
|
error:
Has nothing to do with environment variables and their values. Problem lies in the lack of a serviceaccount directory inside POD. There (in POD where hook is executed) should be directory as below:
|
I also have access to Service Account directory [myhost:/home/users/ashishrajshek]$ kubectl run my-shell --rm -i --tty --image ubuntu:latest -- bash |
Getting this exception when trying to register via POD. $kubectl describe pod pod-with-consul-hook Events: Normal Scheduled default-scheduler Successfully assigned default/pod-with-consul-hook to myhost |
serviceaccount injected to POD must have broader permissions. https://kubernetes.io/docs/reference/access-authn-authz/rbac/#service-account-permissions |
I elevated the permissions to admin role. In POD Events i get the below exceptions: Warning FailedPostStartHook 3m17s kubelet, myhost.com Exec lifecycle hook ([/bin/sh -c /hooks/hooks/consul-registration-hook register k8s]) for Container "service-with-consul-hook-container" in Pod "pod-with-consul-hook_default(624441b4-5fb8-432d-a72c-ab12a4015551)" failed - error: command '/bin/sh -c /hooks/hooks/consul-registration-hook register k8s' exited with 1: When I try to run same command from inside the POD, Service is registered. [myhost:/home/users/ashishrajshek/consul-registration-hook]$ kubectl exec -it pod-with-consul-hook sh /hooks/hooks/consul-registration-hook register k8s2020/07/15 08:35:21 consul-registration-hook (version: ) /hooks/hooks/consul-registration-hook deregister k8s2020/07/15 08:35:46 consul-registration-hook (version: ) |
So everything works, hook should be executed from inside of the POD. |
Are logs stored anywhere inside POD while registering and de registering services. If yes which location? |
Hook prints logs to stdout/err. |
Any idea on this exception: Warning FailedPostStartHook 40s (x3 over 66s) kubelet, myhost.com Exec lifecycle hook ([/bin/sh -c /hooks/hooks/consul-registration-hook register k8s]) for Container "cidtestserver" in Pod "cidtestserver-2_default(a56d696a-e3df-4a07-8d86-65a36e38f284)" failed - error: command '/bin/sh -c /hooks/hooks/consul-registration-hook register k8s' exited with 126: /bin/sh: /hooks/hooks/consul-registration-hook: Permission denied |
Is there any detailed documentation available to setup consul-registration-hook with kubernetes. My requirement is to register PODS and its IP address with Consul.
The text was updated successfully, but these errors were encountered: