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

Kubernetes error with "kubernetes_get_host.py" in monasca-agent #327

Open
nseyvet opened this issue Nov 14, 2017 · 6 comments
Open

Kubernetes error with "kubernetes_get_host.py" in monasca-agent #327

nseyvet opened this issue Nov 14, 2017 · 6 comments
Labels

Comments

@nseyvet
Copy link
Contributor

nseyvet commented Nov 14, 2017

Running the script as is and with monasca pike creates the following error:

  raise exceptions.KubernetesAPIConnectionError(exception_message)
monasca_agent.common.exceptions.KubernetesAPIConnectionError: Could not get agent pod from Kubernetes API to get host IP with error - HTTPSConnectionPool(host='10.0.0.1', port=443): Max retries exceeded with url: //api/v1/namespaces/default/pods/monasca-agent-deployment-1746399571-4l84t (Caused by SSLError(CertificateError("hostname '10.0.0.1' doesn't match either of 'kubernetes.default.svc.cluster.local', 'kubernetes.default.svc', 'kubernetes.default', 'kubernetes', 'localhost', '192.168.99.101', '10.0.0.1'",),))

The kubernetes service in 1.7.5 is defined as:

$ kubectl describe service kubernetes
Name:              kubernetes
Namespace:         default
Labels:            component=apiserver
                   provider=kubernetes
Annotations:       <none>
Selector:          <none>
Type:              ClusterIP
IP:                10.0.0.1
Port:              https  443/TCP
TargetPort:        8443/TCP
Endpoints:         10.0.2.15:8443
Session Affinity:  ClientIP
Events:            <none>


This could be tied to kubernetes-client/python#36 ?

The python script "kubernetes_get_host.py" used in monasca-agent can be replaced with the DownwardAPI (see https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/) and the variable injected via en environment variable:

   env:
        - name: AGENT_HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName

I would propose to remove the python script and associated code in Dockerfile, and start.sh, etc and instead document how to inject the nodename.

If that is acceptable, I can prepare a fix.

@timothyb89
Copy link
Member

I think kubernetes_get_host.py predates nodeName being available in the downward API, but it would be good to switch. Maybe @mhoppal can confirm?

@timothyb89
Copy link
Member

That said, you're right, the cause of the error is probably due to outdated ipaddress and urllib3 packages (see also). Removing kubernetes_get_host.py will fix this issue and let the agent start, but the plugins that use the kubernetes API should still fail.

If you're getting this from the monasca/agent containers that's pretty surprising... no idea how we haven't hit that in the agent plugins.

@timothyb89
Copy link
Member

Output from the latest agent-collector image shows compatible versions:

[tim:~]↥ 3s % docker run --rm=true -it monasca/agent-collector:master-20171121-122311 pip list | grep -E '(urllib3|ipaddress)'
ipaddress (1.0.18)
urllib3 (1.22)

@nseyvet
Copy link
Contributor Author

nseyvet commented Nov 22, 2017 via email

@witekest
Copy link
Member

The upstream bugfix has been merged. Are any actions still required here?

@nseyvet
Copy link
Contributor Author

nseyvet commented Jan 17, 2018 via email

@timothyb89 timothyb89 added the bug label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants