DEV Community

Cover image for parsing json in kubernetes use jq
martabakgosong
martabakgosong

Posted on • Edited on

parsing json in kubernetes use jq

get template deployment
k get -n namespace deployment/name-deployment -o json | jq 'del(.metadata.resourceVersion,.metadata.uid,.metadata.selfLink,.metadata.creationTimestamp,.metadata.annotations,.metadata.generation,.metadata.ownerReferences,.status)' | yq eval --prettyPrint > name-deployment.yml

get template svc
k get -n namespace deployment/name-deployment -o json | jq 'del(.metadata.resourceVersion,.metadata.uid,.metadata.selfLink,.metadata.creationTimestamp,.metadata.annotations,.metadata.generation,.metadata.ownerReferences,.spec.ClusterIP,.specClusterIPS,.status)' | yq eval --prettyPrint > name-deployment.yml

Top comments (0)