Hi John
Yes, OpenShift builds on Kubernetes, they call it a Kubernetes distribution. To me it is a fancy webgui on top of kubernetes.
I indeed used the yaml files you referred to. The mechanism of listing nodes that you describe is exactly what fails. After application and insantiation i get the following error logs, indicating the listing / registration of Nodes fails because we are not allowed to list them at cluster level:
INFO> k8s_register
Task exception was never retrieved
future: <Task finished name=‘Task-3’ coro=<healthCheck() done, defined at /usr/local/lib/python3.8/site-packages/hsds/basenode.py:413> exception=ApiException()>
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/hsds/basenode.py”, line 429, in healthCheck
await k8s_register(app)
File “/usr/local/lib/python3.8/site-packages/hsds/basenode.py”, line 313, in k8s_register
ret = v1.list_pod_for_all_namespaces(watch=False)
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py”, line 14098, in list_pod_for_all_namespaces
(data) = self.list_pod_for_all_namespaces_with_http_info(kwargs) # noqa: E501
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/api/core_v1_api.py”, line 14179, in list_pod_for_all_namespaces_with_http_info
return self.api_client.call_api(
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py”, line 340, in call_api
return self.__call_api(resource_path, method,
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py”, line 172, in __call_api
response_data = self.request(
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/api_client.py”, line 362, in request
return self.rest_client.GET(url,
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/rest.py”, line 237, in GET
return self.request(“GET”, url,
File “/usr/local/lib/python3.8/site-packages/kubernetes/client/rest.py”, line 231, in request
raise ApiException(http_resp=r)
kubernetes.client.rest.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({‘Cache-Control’: ‘no-store’, ‘Content-Type’: ‘application/json’, ‘X-Content-Type-Options’: ‘nosniff’, ‘Date’: ‘Mon, 02 Nov 2020 05:08:35 GMT’, ‘Content-Length’: ‘277’})
HTTP response body: {“kind”:“Status”,“apiVersion”:“v1”,“metadata”:{},“status”:“Failure”,“message”:"pods is forbidden: User "system:serviceaccount:***************:default" cannot list pods at the cluster scope: no RBAC policy matched",“reason”:“Forbidden”,“details”:{“kind”:“pods”},“code”:403}
When trying to apply the RBAC, i get the following errror. Talking to my provider they confirmed this is something we can’t do on a shared kubernetes cluster as it would allow us to list pods of other customers which of course is not going to happen. Here’s the error log for reference:
Error from server (Forbidden): error when creating “k8s_rbacV1.yml”: clusterroles.rbac.authorization.k8s.io is forbidden: User “*************” cannot create clusterroles.rbac.authorization.k8s.io at the cluster scope: no RBAC policy matched
If i run the command “oc get pods” on the terminal i can list the pods as this command will only list pods in the current project which i do have the rights for:
NAME READY STATUS RESTARTS AGE
vorn-hsds-5f5b55bb74-w57c9 2/2 Running 0 24m
Trying to list the pods at cluster level fails:
oc get pods --all-namespaces
No resources found.
Error from server (Forbidden): pods is forbidden: User “*************” cannot list pods at the cluster scope: no RBAC policy matched
Calling the same with a bit more information output i see the pods IP:
oc get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE
vorn-hsds-5f5b55bb74-w57c9 2/2 Running 0 28m 10.******** node2854.******************
So i think we’d have to adapt either to a less greedy version of the API getting pods only from the current project or find a different way of listing the pods?
It seems to me that the info i can get on the commandline should be sufficient for the registration so the same should be doable using the API.