https://github.com/trstringer/kubectl-example
kubectl plugin to dump example helper resource templates
https://github.com/trstringer/kubectl-example
Last synced: 9 months ago
JSON representation
kubectl plugin to dump example helper resource templates
- Host: GitHub
- URL: https://github.com/trstringer/kubectl-example
- Owner: trstringer
- License: other
- Created: 2023-01-28T12:19:59.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-20T13:29:22.000Z (almost 3 years ago)
- Last Synced: 2025-02-25T23:34:22.465Z (11 months ago)
- Language: Go
- Size: 30.3 KB
- Stars: 13
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kubectl example
Quickly and easily create example manifests so you don't have to remember Kubernetes resource manifest syntax.
## Installation
```
$ make install
```
*Note: This installs the plugin in ~/.local/bin. If you prefer to use a different directory in your `$PATH` then modify the `Makefile` prior to running `make install`.*
Verify installation:
```
$ kubectl example --help
Show example manifests for resources
Usage:
kubectl-example [flags]
Flags:
-h, --help help for kubectl-example
-l, --list list available resources
```
## Usage
List out all available example manifests:
```
$ kubectl example --list
deployment
gateway [gateway.networking.k8s.io/v1beta1 networking.istio.io/v1beta1]
namespace
pod
service
virtualservice
```
*Note: This list will continue to grow as I add more example manifests. PRs welcome and appreciated!*
Dump out a deployment example manifest:
```
$ kubectl example deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: STRING
namespace: STRING
spec:
replicas: 1234
selector:
matchLabels:
STRING: STRING
template:
metadata:
labels:
STRING: STRING
spec:
containers:
- name: STRING
image: STRING
imagePullPolicy: STRING # Always, IfNotPresent, Never
ports:
- containerPort: 1234
```
You can also dump multiple manifests at the same time:
```
$ kubectl example namespace pod
apiVersion: v1
kind: Namespace
metadata:
name: STRING
---
apiVersion: v1
kind: Pod
metadata:
name: STRING
namespace: STRING
spec:
containers:
- name: STRING
image: STRING
imagePullPolicy: STRING # Always, IfNotPresent, Never
ports:
- containerPort: 1234
```
Then, just modify the placeholders to your desired values, delete unwanted sections, add whatever you want and create these resources in your Kubernetes clusters!