Skip to content
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

Inconsistent domain names for service discovery #21

Open
marekjelen opened this issue Jul 6, 2017 · 0 comments
Open

Inconsistent domain names for service discovery #21

marekjelen opened this issue Jul 6, 2017 · 0 comments
Assignees

Comments

@marekjelen
Copy link

Minishift and Kubernetes default to different namespaces, myproject and default respectively and that makes the service discovery chapter non-consistent across environments.

The command

kubectl exec jumpod -c shell -i -t -- ping thesvc.default.svc.cluster.local

will work on Kubernetes cluster, but not in OpenShift as default is restricted and in most installation including minishift the user will no be allowed to use the namespace.

In case the tutorials want to as well target on-lin service users, it should not rely on hard-coded name, as the namespace names has to be unique across users, it would only work for one user.

There are some possible ways how to solve this.

The content could be tweaked so that the user is well aware of the namespaces. But that would require creation of separate paths for Kubernetes and OpenShift, as they have different ways to create them.

Other way is to teach the user some way how to learn the namepace, (is there actually some simple command on kubectl level what would return the current namespace ?) e.g.

kubectl get pod jumpod -o jsonpath="{.metadata.namespace}"

and then let the user substitute the name in the command

kubectl exec jumpod -c shell -i -t -- getent hosts thesvc.$YOUR_NAMESPACE.svc.cluster.local

Another one is provide some command that would figure out the FQDN on the server at runtime, like this dirty hack

kubectl exec jumpod -c shell -i -t -- /bin/bash -c 'NAME=`cat /etc/resolv.conf | grep -o "search [^ ]*"`; NAME=($NAME); NAME=${NAME[1]}; getent hosts thesvc.$NAME'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants