{"id":20957329,"url":"https://github.com/abcdesktopio/oc.pyos.debug-tools","last_synced_at":"2025-06-12T21:34:27.120Z","repository":{"id":209359613,"uuid":"723832168","full_name":"abcdesktopio/oc.pyos.debug-tools","owner":"abcdesktopio","description":"simple debug tools for kubernetes troubleshooting with pyos","archived":false,"fork":false,"pushed_at":"2023-11-27T10:19:29.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T23:46:51.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abcdesktopio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-26T21:52:11.000Z","updated_at":"2023-11-26T22:04:29.000Z","dependencies_parsed_at":"2023-11-26T23:21:42.288Z","dependency_job_id":"e3d0e787-10b7-43a4-b02c-5f69627f1ae4","html_url":"https://github.com/abcdesktopio/oc.pyos.debug-tools","commit_stats":null,"previous_names":["abcdesktopio/oc.pyos.debug-tools"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Foc.pyos.debug-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Foc.pyos.debug-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Foc.pyos.debug-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abcdesktopio%2Foc.pyos.debug-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abcdesktopio","download_url":"https://codeload.github.com/abcdesktopio/oc.pyos.debug-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243352034,"owners_count":20276916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T01:31:38.428Z","updated_at":"2025-03-13T06:13:36.322Z","avatar_url":"https://github.com/abcdesktopio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oc.pyos.debug-tools\nsimple debug tools for kubernetes troubleshooting with pyos.\n\nIt contains a simple python script to check config and list pods in `$POD_NAMESPSACE`\n\nLoad the `load_incluster_config()` or `load_kube_config()`\n```\ntry:\n    config.load_incluster_config() # set up the client from within a k8s pod\nexcept Exception as e_in:\n    try:\n        config.load_kube_config()\n    except Exception as e_out:\n        print( f\"This is a fatal error\" )\n```\n\nList pods in `$POD_NAMESPSACE`\n\n```\ntime_to_sleep_in_second = 30\nwhile(True):\n  try:\n    api_response = v1.list_namespaced_pod(namespace=namespace, pretty=True)\n    pprint(api_response)\n  except ApiException as e:\n    print(\"Exception when calling CoreV1Api-\u003elist_namespaced_pod: %s\\n\" % e)\n  print( f\"sleeping for {time_to_sleep_in_second}\" )\n  sleep(time_to_sleep_in_second)\n```\n\n# To build\n\n```\ngit clone https://github.com/abcdesktopio/oc.pyos.debug-tools.git\ndocker build -t abcdesktopio/pyos-debug-tools:main .\n```\n\n# To run \n\n```\nkubectl apply -f https://raw.githubusercontent.com/abcdesktopio/oc.pyos.debug-tools/main/pyos-debug-tools.yaml\n```\n\n# To logs \n\n```\nkubectl logs pyos-debug-tools -n abcdesktop\n```\n\nYou should read on stdout\n\n```\nInitializing ...\nKUBERNETES_SERVICE_HOST=10.96.0.1\nKUBERNETES_SERVICE_PORT=443\nKUBERNETES_SERVICE_PORT_HTTPS=443\nload_incluster_config done\nuse namespace=abcdesktop\nlisting pods in abcdesktop:\n{'api_version': 'v1',\n 'items': [{'api_version': None,\n            'kind': None,\n            'metadata': {'annotations': None,\n                         'creation_timestamp': datetime.datetime(2023, 10, 24, 14, 25, 7, tzinfo=tzlocal()),\n                         'deletion_grace_period_seconds': None,\n                         'deletion_timestamp': None,\n                         'finalizers': None,\n                         'generate_name': 'daemonset-nginx-',\n                         'generation': None,\n                         'labels': {'controller-revision-hash': '56984c456d',\n                                    'name': 'daemonset-nginxpods',\n                                    'netpol/dns': 'true',\n                                    'netpol/memcached': 'true',\n                                    'netpol/ocuser': 'true',\n                                    'netpol/pyos': 'true',\n                                    'netpol/speedtest': 'true',\n                                    'pod-template-generation': '4',\n                                    'run': 'nginx-od',\n                                    'type': 'frontend,\n                                    ...\n[CUT HERE] \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabcdesktopio%2Foc.pyos.debug-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabcdesktopio%2Foc.pyos.debug-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabcdesktopio%2Foc.pyos.debug-tools/lists"}