A small script to return a list of kubernetes resources.
Find a file
Elia El Lazkani 2bec96f972 Fixing README
2019-03-07 18:43:13 -05:00
get-k8s-resources.py Second commit 2019-03-07 18:41:45 -05:00
README.rst Fixing README 2019-03-07 18:43:13 -05:00
requirements.txt Second commit 2019-03-07 18:41:45 -05:00

Get K8s Resources
=================

The `get_k8s_resources` script is a small script that will return a list of all instances of a certain kubernetes type.

Usage
-----

::
    $ get-k8s-resources -h
    usage: get-k8s-resources.py [-h] [-n NAMESPACE] [-c CONTEXT] -t
                                {deployments,services,pods,ingresses}
 
    Returns a json list of kubernetes deployments.
 
    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


Requirements
------------

The requirements can be found in the `requirements.txt` file in this repository.

Configuration
-------------

By default, this tool will try to find your kubeconfig in the default paths where `kubectl` 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.