A simple Ruby-script to export k8s resources, and removes a pre-defined set of fields for later import
kubectl eksporter <resource> <name>
-n / --namespace
and other arguments are supported by proxy.
The eksporter also supports piping.
You can easily remove more fields with the --drop
argument. List the fields (also nested fields) to be removed.
If you need some of the pre-defined fields, you can list them with --keep
and they will not be removed.
$ kubectl eksporter ingress testapp
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
labels:
app: testapp
environment: default
name: testapp
spec:
rules:
- host: testapp.local
http:
paths:
- backend:
serviceName: testapp
servicePort: 80
path: "/"
The following command wil give the same result.
$ kubectl get ingress testapp -o yaml | kubectl eksporter
First you need install Krew, by following the installation guide.
Then just run kubectl krew install eksporter
Python didn't have a built-in yaml-converter, and Go is a hassle to work with when you need generic data structures.
- Make changes to the code
- Tag with
git tag -a v1.3.0
- New release is automated created and pushed to Krew