ksecret is a command-line tool to simplify the management of Kubernetes Secrets. It provides functionalities to encode, decode, and generate Kubernetes Secret YAML files.
- 🔐 Encode/Decode Secrets: Easily encode and decode the
datafield in your Kubernetes Secret files from and to base64. - 📝 Generate from
.env: Create a Kubernetes Secret YAML file directly from a.envfile. - 🌱 Generate Environment Variables: Automatically generate Kubernetes
enventries for your deployments from Secret and ConfigMap YAML files.
You can install ksecret using pip:
pip install ksecretksecret provides several commands to help you manage your Kubernetes secrets.
To base64 encode the values in the data field of a Secret YAML file:
ksecret encode my-secret.yamlThis will overwrite the my-secret.yaml file with the encoded data. You can specify an output file using the -o or --output option.
To decode the base64 encoded values in the data field of a Secret YAML file:
ksecret decode my-secret.yamlThis will overwrite the my-secret.yaml file with the decoded data. You can specify an output file using the -o or --output option.
To generate a Kubernetes Secret YAML file from a .env file:
ksecret generate --name my-secret --namespace my-namespace --env-file .env --output my-secret.yamlThis will create a new file named my-secret.yaml with the generated secret.
To generate a list of environment variables for a Kubernetes Deployment from Secret and ConfigMap YAML files:
ksecret generate-env-from-yamls -f my-secret.yaml -f my-configmap.yamlThis will print the env entries to the console. You can save the output to a file using the -o or --output option.
Contributions are welcome! Please feel free to submit a pull request or open an issue on the GitHub repository.
This project is licensed under the BSD 3-Clause License.