get-k8s-resources/README.md

34 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

2021-03-20 10:54:32 +00:00
# Get K8s Resources
2019-03-07 23:41:45 +00:00
The `get_k8s_resources` script is a small script that will return a list of all instances of a certain kubernetes type `JSON` formatted.
2019-03-07 23:41:45 +00:00
2021-03-20 10:55:21 +00:00
## Usage
2021-03-20 10:52:35 +00:00
``` text
2019-03-07 23:43:13 +00:00
$ get-k8s-resources -h
2019-03-08 00:05:31 +00:00
usage: get-k8s-resources [-h] [-n NAMESPACE] [-c CONTEXT] -t
2019-03-07 23:43:13 +00:00
{deployments,services,pods,ingresses}
2021-03-20 10:52:35 +00:00
2019-03-07 23:43:13 +00:00
Returns a json list of kubernetes deployments.
2021-03-20 10:52:35 +00:00
2019-03-07 23:43:13 +00:00
optional arguments:
-h, --help show this help message and exit
-n NAMESPACE, --namespace NAMESPACE
filter by namespace
-c CONTEXT, --context CONTEXT
context to use
-t {deployments,services,pods,ingresses}, --type {deployments,services,pods,ingresses}
type of kubernetes resource to get
--kubeconfig KUBECONFIG
path to the kubeconfig
2019-03-07 23:41:45 +00:00
2021-03-20 10:52:35 +00:00
```
2019-03-07 23:41:45 +00:00
2021-03-20 10:55:21 +00:00
## Requirements
2019-03-07 23:41:45 +00:00
2021-03-20 10:54:32 +00:00
The requirements can be found in the [requirements.txt](requirements.txt) file in this repository.
2019-03-07 23:41:45 +00:00
2021-03-20 10:55:21 +00:00
## Configuration
2019-03-07 23:41:45 +00:00
2021-03-20 10:52:35 +00:00
By default, this tool will try to find your kubeconfig in the default paths where [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/) looks for. It will also try to take assumptions on which `context` it should be using if there are multiple contexts in the same configuration. Generally, it should work as shown in the help menu.