ksd


Nameksd JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryUtility for decoding Kubernetes secret resources
upload_time2024-02-28 00:11:05
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords kubernetes kubectl secrets
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Easily Read Kubernetes Secrets

Read base64 encoded Kubernetes secrets without getting in your way.

Kubernetes secrets resources base64 encode the secret values. It is often
useful to view the decoded values for those secrets in place. This tool
offers a useful means to do that. 

## Features

- allows you to read one or more Secrets
- works with individual secrets, lists of secrets, and multiple yaml docs
- simple auditable Python source code

### Install

Install with pip

```bash
pip install ksd
```

Install with pipx

```bash
pipx install ksd
```

## Quick Example

```bash
$ kubectl get secret -n mynamespace -o yaml mysecret | ksd
```
```yaml
apiVersion: v1
data:
  password: my-decoded-password-secret
  username: my-decoded-username-secret
kind: Secret
metadata:
  creationTimestamp: '2024-01-01T00:00:0Z'
  labels:
    name: mynamespace
  name: mysecret
  namespace: mynamespace
  resourceVersion: '1234'
  uid: c4f4c4db-bdba-47d0-9a17-1e307e1448c7
type: Opaque
```

## Detailed Usage

Get help

```bash
ksd --help
```

Get single secret as YAML and decode as YAML

```bash
kubectl get secret -o yaml mysecret | ksd 
```

Get single secret as YAML and decode as JSON

```bash
kubectl get secret -o yaml mysecret | ksd -f json
```

Get multiple secrets as YAML and decode as YAML

```bash
kubectl get secret -o yaml  | ksd
```

Get multiple secrets as YAML and decode as JSON

```bash
kubectl get secret -o yaml  | ksd -f json
```

Get secrets as JSON and decode as YAML

```bash
kubectl  get secret -o json | ksd
```

Get secrets as JSON and decode as JSON

```bash
kubectl  get secret -o json | ksd -f json
```


Use k8s flags as normal

```bash
kubectl  get secret -n my_namespace -l label_key=label_value -o json | ksd
```

I don't know why you would do this, but the output is idempotent

```bash
kubectl get secret -o yaml  | ksd | ksd
```

Read Secrets from a file 

```bash
cat secrets.yaml | ksd
```

Suppoert multi-document yaml input (separated with the yaml '---')

```bash
kubectl get secret -o yaml mysecret > secrets.yaml
echo "---" >> secrets.yaml
kubectl get secret -o yaml ohter_secret >> secrets.yaml
cat secrets.yaml | ksd
```


## Inspired by

There are several projects with a similar name and purpose. However, they
are written in Go and distribute compiled binaries. I prefer to use a version
of this tool written in Python, for which the source code is auditable. 


## Tests

```bash
pip install -e .[tests]
pytest -vvv tests/
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ksd",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "kubernetes,kubectl,secrets",
    "author": "",
    "author_email": "Joe Jasinski <joe.jasinski@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/39/db/aad403d5ef00602e8ba88ae8d8142f71a0ddb6f96f3f0acdbb96bb091cd0/ksd-0.1.3.tar.gz",
    "platform": null,
    "description": "# Easily Read Kubernetes Secrets\n\nRead base64 encoded Kubernetes secrets without getting in your way.\n\nKubernetes secrets resources base64 encode the secret values. It is often\nuseful to view the decoded values for those secrets in place. This tool\noffers a useful means to do that. \n\n## Features\n\n- allows you to read one or more Secrets\n- works with individual secrets, lists of secrets, and multiple yaml docs\n- simple auditable Python source code\n\n### Install\n\nInstall with pip\n\n```bash\npip install ksd\n```\n\nInstall with pipx\n\n```bash\npipx install ksd\n```\n\n## Quick Example\n\n```bash\n$ kubectl get secret -n mynamespace -o yaml mysecret | ksd\n```\n```yaml\napiVersion: v1\ndata:\n  password: my-decoded-password-secret\n  username: my-decoded-username-secret\nkind: Secret\nmetadata:\n  creationTimestamp: '2024-01-01T00:00:0Z'\n  labels:\n    name: mynamespace\n  name: mysecret\n  namespace: mynamespace\n  resourceVersion: '1234'\n  uid: c4f4c4db-bdba-47d0-9a17-1e307e1448c7\ntype: Opaque\n```\n\n## Detailed Usage\n\nGet help\n\n```bash\nksd --help\n```\n\nGet single secret as YAML and decode as YAML\n\n```bash\nkubectl get secret -o yaml mysecret | ksd \n```\n\nGet single secret as YAML and decode as JSON\n\n```bash\nkubectl get secret -o yaml mysecret | ksd -f json\n```\n\nGet multiple secrets as YAML and decode as YAML\n\n```bash\nkubectl get secret -o yaml  | ksd\n```\n\nGet multiple secrets as YAML and decode as JSON\n\n```bash\nkubectl get secret -o yaml  | ksd -f json\n```\n\nGet secrets as JSON and decode as YAML\n\n```bash\nkubectl  get secret -o json | ksd\n```\n\nGet secrets as JSON and decode as JSON\n\n```bash\nkubectl  get secret -o json | ksd -f json\n```\n\n\nUse k8s flags as normal\n\n```bash\nkubectl  get secret -n my_namespace -l label_key=label_value -o json | ksd\n```\n\nI don't know why you would do this, but the output is idempotent\n\n```bash\nkubectl get secret -o yaml  | ksd | ksd\n```\n\nRead Secrets from a file \n\n```bash\ncat secrets.yaml | ksd\n```\n\nSuppoert multi-document yaml input (separated with the yaml '---')\n\n```bash\nkubectl get secret -o yaml mysecret > secrets.yaml\necho \"---\" >> secrets.yaml\nkubectl get secret -o yaml ohter_secret >> secrets.yaml\ncat secrets.yaml | ksd\n```\n\n\n## Inspired by\n\nThere are several projects with a similar name and purpose. However, they\nare written in Go and distribute compiled binaries. I prefer to use a version\nof this tool written in Python, for which the source code is auditable. \n\n\n## Tests\n\n```bash\npip install -e .[tests]\npytest -vvv tests/\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Utility for decoding Kubernetes secret resources",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/JoeJasinski/ksd"
    },
    "split_keywords": [
        "kubernetes",
        "kubectl",
        "secrets"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f22bd84a627f70aa4dee1ee35600b63db3941018a593caf846bb23ab341f7a29",
                "md5": "449818ee520929c226813e1eb0df66af",
                "sha256": "05c7156ed18a8bebec559dfc2d06f6087b114fcd6e0455ab750fdfbb6b6923f0"
            },
            "downloads": -1,
            "filename": "ksd-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "449818ee520929c226813e1eb0df66af",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5015,
            "upload_time": "2024-02-28T00:11:04",
            "upload_time_iso_8601": "2024-02-28T00:11:04.295253Z",
            "url": "https://files.pythonhosted.org/packages/f2/2b/d84a627f70aa4dee1ee35600b63db3941018a593caf846bb23ab341f7a29/ksd-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "39dbaad403d5ef00602e8ba88ae8d8142f71a0ddb6f96f3f0acdbb96bb091cd0",
                "md5": "133f2303de781f4144df3e0cca2e45d5",
                "sha256": "25b9dc833fc1a48a9d3f56505527ec92e4543f729f7c0bee939a9397e46ee49b"
            },
            "downloads": -1,
            "filename": "ksd-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "133f2303de781f4144df3e0cca2e45d5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5757,
            "upload_time": "2024-02-28T00:11:05",
            "upload_time_iso_8601": "2024-02-28T00:11:05.916604Z",
            "url": "https://files.pythonhosted.org/packages/39/db/aad403d5ef00602e8ba88ae8d8142f71a0ddb6f96f3f0acdbb96bb091cd0/ksd-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-28 00:11:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JoeJasinski",
    "github_project": "ksd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "ksd"
}
        
Elapsed time: 0.19666s