How to Create Manifest for Existing Objects and Strip Identifiers?

4/9/2019

Goal: Create a generic manifest for an existing deployment and strip the cluster distinct details. Deploy this manifest on a different cluster.

Progress:

kubectl get deployment <DEPLOYMENT_NAME> -n <NAMESPACE> -o yaml

Generates a deployment file but it has all sorts of info that is distinct to this cluster / instantiation and must be stripped. For example:

lastTransitionTime: 2019-03-20T23:38:42Z

lastUpdateTime: 2019-03-20T23:39:13Z

uid: 53444c69-acac-11e8-b870-0af323746f0a

resourceVersion: "97102711"

creationTimestamp: 2018-08-30T23:27:56Z

... just to name a few.

Is there an option to remove these fields in return or an easy way to only pull the minimum definitions to replicate the object in another cluster?

-- ProGirlXOXO
kubernetes

1 Answer

4/9/2019

As suggested by @Matthew L Daniel kubectl get deployment <DEPLOYMENT_NAME> -n <NAMESPACE> -o yaml --export=true will do the work.

You can also find useful kubectl tricks here and here. Additionality full kubectl reference can be found here.

-- MWZ
Source: StackOverflow