https://github.com/pedrobarco/kubectl-print-env
Build config files from k8s environments
https://github.com/pedrobarco/kubectl-print-env
golang kubectl-plugins kubernetes
Last synced: 4 months ago
JSON representation
Build config files from k8s environments
- Host: GitHub
- URL: https://github.com/pedrobarco/kubectl-print-env
- Owner: pedrobarco
- License: mit
- Created: 2022-03-12T22:52:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-06-10T22:45:28.000Z (about 1 year ago)
- Last Synced: 2025-07-31T22:49:38.194Z (11 months ago)
- Topics: golang, kubectl-plugins, kubernetes
- Language: Go
- Homepage:
- Size: 70.3 KB
- Stars: 22
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kubectl-print-env
A kubectl plugin for building config files from k8s environments
With `kubectl-print-env`, it is possible to create a config file from kubernetes
resources. This plugin prints configs by parsing environment information about
the specified resources. You can select the output format using the `--output`
flag.
## Installation
`kubectl-print-env` can be installed using [Krew](https://krew.sigs.k8s.io):
```bash
$ kubectl krew install print-env
```
or by downloading the binary from the [releases](https://github.com/pedrobarco/kubectl-print-env/releases) page.
Alternatively, `kubectl-print-env` can be installed by running
```bash
$ go install github.com/pedrobarco/kubectl-print-env/cmd/kubectl-print-env
```
or by cloning this repository and running:
```bash
$ make build && sudo make install
```
## Usage
When used as a kubectl plugin the command is `kubectl print-env`, and when
used as a standalone executable it's `kubectl-print-env`.
```
kubectl print-env [(-o|--output=)dotenv|json|toml|yaml] (TYPE[.VERSION][.GROUP] [NAME] | TYPE[.VERSION][.GROUP]/NAME) [flags]
Examples:
# Build a dotenv config file from a pod
kubectl print-env pods my-pod
# Build a JSON config file from a deployment, in the "v1" version of the "apps" API group
kubectl print-env deployments.v1.apps my-deployment -o json
# Build a YAML config file from a configmap
kubectl print-env cm/my-configmap -o yaml
# Build a TOML config file from a secret, decoding secret values
kubectl print-env secret my-secret -o toml
```
## Specification
This plugin supports the following resource types:
- [x] ConfigMap
- [x] Secret
- [x] Pod
- [ ] Daemonset
- [ ] Replicaset
- [ ] Statefulset
- [x] Deployment
- [x] Job
- [ ] CronJob
- [ ] Service
- [ ] Ingress
> NOTE: When running `kubectl-print-env`, only resources of this type will be checked