I'm looking for a way to export a yaml file from a deployed component but without the cluster specific information.
kubectl get MYOBJECT --export -o yaml > my.yaml
but since "export" is now deprecated (since 1.14 and should normally disappear in 1.18 (didn't find it in changelog), what would be an alternative ?
thanks
From the Service type drop-down list, select Node port. Click Expose. When your Service is ready, the Service details page opens, and you can see details about your Service. Under Ports, make a note of the Node Port that Kubernetes assigned to your Service.
kubectl autoscale creates a HorizontalPodAutoscaler (or HPA) object that targets a specified resource (called the scale target) and scales it as needed.
Kubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane, using the Kubernetes API.
That's not quite accurate, kubectl create has several sub-commands which allow you to create resources without writing yaml, there's no pod creation, but that part of kubectl run is not being deprecated.
The ‘export’ flag in kubectl was deprecated in 1.18, but you still need a way to dump the yaml of Kubernetes objects, often for the purpose of reapplying changes.
It would be very use for kubectl to be able to export all api objects in a namespace from a running cluster to JSON/YAML files, and import that state from files to another cluster.
What the deprecation message hints (and is also clarified by the answer provided by @soltysh) is that the particular practice will be removed. So in future kubernetes versions, the run command will by default (and as only option) create pods (and not deployments), i.e. the command in its full extend will become:
Using JQ does the trick.
kubectl get secret <secretname> -ojson | jq 'del(.metadata.namespace,.metadata.resourceVersion,.metadata.uid) | .metadata.creationTimestamp=null'
produces exactly the same JSON as
kubectl get secret <secretname> -ojson --export
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With