rchakode/kube-opex-analytics

Unauthorized error

freexploit opened this issue · 9 comments

I'm getting this error

2019-08-15 04:29:40,180 - kube-opex-analytics - ERROR - call to http://127.0.0.1:8001/api/v1/nodes returned error ({"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}
)

On documentation doesn't say where to put the config file or setup KUBECONFIG environment variable.

Hi @freexploit,
Where do you run it? On Docker or on Kubernetes Clusters?
Config are set via environment variables, not in a config file (check the table of contents in the README file

KUBECONFIG is needed if you use kubectl proxy (what is independent from kube-opex-analytics).

Yes, I ran kubectl proxy then I ran on docker locally this command:

docker run -it \
    --net="host" \
    --name 'kube-opex-analytics' \
    -v /var/lib/kube-opex-analytics:/data \
    -v /home/freexploit/Downloads/:/config \
    -e KUBECONFIG=/config/config.yaml \
    -e KOA_DB_LOCATION=/data/db \
    -e KOA_K8S_API_ENDPOINT=http://127.0.0.1:8001 \
    rchakode/kube-opex-analytics

I set the KUBECONFIG variable inside the container.

You don't need to mount a config volume, neither nor KUBECONFIG is required to be set within the container.

When you run kubectl proxy you use your local credentials to authenticate on Kubernetes API.
The Unauthorized 401 error is likely because the user set in your local config may not have sufficient access to Kubernetes API, due to your RBAC policies?

Did you try to run kube-opex-analytics directly on Kubernetes?

Dear @freexploit
We reproduced this issue, and will fix it in the next release expected the next close days.

@freexploit, we just made a new release v0.4.0 that should fix this issue.
Can you give it a try?

@rchakode I will testing it, thank you!!!

same issue!

I deployed the later helm chart and I am getting

/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made to host 'kubernetes.default'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, /usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made to host 'kubernetes.default'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, WARNING:waitress.queue:Task queue depth is 1 WARNING:waitress.queue:Task queue depth is 2

No data is shown on the dashboard.

Hi @vaibhavjain882,
What I'm watching in your log are just warning.
As indicated in the README, you may need to wait about 30 minutes or an hour to have initial charts. The reason being that kube-opex-analytics aggregates metrics for hourly-based analytics.

Edit: can you confirm that you know have charts?