Follow up to T233372: Create a "novaobserver" equivalent for Toolforge Kubernetes cluster inspection. I would like the k8s-status tool to show the number of nodes in the cluster and possibly some data on how much CPU/RAM is in use.
>>> import kubernetes >>> kubernetes.config.load_incluster_config() >>> v1 = kubernetes.client.CoreV1Api() >>> v1.list_node() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13267, in list_node (data) = self.list_node_with_http_info(**kwargs) File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13361, in list_node_with_http_info collection_formats=collection_formats) File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 334, in call_api _return_http_data_only, collection_formats, _preload_content, _request_timeout) File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 168, in __call_api _request_timeout=_request_timeout) File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/api_client.py", line 355, in request headers=headers) File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/rest.py", line 231, in GET query_params=query_params) File "/data/project/k8s-status/www/python/venv/lib/python3.7/site-packages/kubernetes/client/rest.py", line 222, in request raise ApiException(http_resp=r) kubernetes.client.rest.ApiException: (403) Reason: Forbidden HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'X-Content-Type-Options': 'nosniff', 'Date': 'Mon, 23 Dec 2019 18:01:23 GMT', 'Content-Length': '292'}) HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"nodes is forbidden: User \"system:serviceaccount:tool-k8s-status:k8s-status-obs\" cannot list resource \"nodes\" in API group \"\" at the cluster scope","reason":"Forbidden","details":{"kind":"nodes"},"code":403}