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

tries to use kubernetes.default.svc instead of KUBERNETES_SERVICE_HOST=k1api.domain.de #12

Open
titansmc opened this issue Nov 20, 2023 · 1 comment
Assignees

Comments

@titansmc
Copy link

We are overwriting KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT because we need pyos to reach the API servers directly, since after applying some network policies, the default namespace service cannot be reached.
What is it failing still why it still tries to use kubernetes.default.svc instead ?

[root@moscardo ~]# kubectl exec -ti -n abcdesktop-ns pyos-od-598d4d6989-49ffm -- env|grep KUB
KUBERNETES_SERVICE_HOST=k1api.domain.de
KUBERNETES_SERVICE_PORT=6443
KUBERNETES_SERVICE_PORT_HTTPS=6443
KUBERNETES_PORT_443_TCP=tcp://10.133.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT=tcp://10.133.0.1:443
KUBERNETES_PORT_443_TCP_ADDR=10.133.0.1
@alexandredevely
Copy link
Member

Hello titansmc,

if KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT are defined then pyos loads the incluster config else it loads kube config.

       if os.getenv('KUBERNETES_SERVICE_HOST') and os.getenv('KUBERNETES_SERVICE_PORT') :
            config.load_incluster_config() # set up the client from within a k8s pod
        else:
            config.load_kube_config()

This could be the source of this issue, could you try to unset KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT and use kube config.

I hope this will help you

Alexandre

@alexandredevely alexandredevely self-assigned this Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants