{"id":1888,"date":"2022-12-04T08:44:07","date_gmt":"2022-12-04T14:44:07","guid":{"rendered":"https:\/\/blog.ls-al.com\/?p=1888"},"modified":"2022-12-04T08:44:19","modified_gmt":"2022-12-04T14:44:19","slug":"kubectl-export","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/kubectl-export\/","title":{"rendered":"kubectl export"},"content":{"rendered":"
Since kubectl --export is deprecated it is possible to do something like this. <\/p>\n
\nWARNING: I have not tested this<\/p>\n<\/blockquote>\n
#!\/bin\/bash\nd=$(date +%Y%m%d)\nBACKUP_TARGET="\/TANK\/ARCHIVE\/argocd-backups\/argocd_backup_yaml"\nkubectl -n argocd get cm -o=json | jq 'del(.metadata.resourceVersion,.metadata.uid,.metadata.selfLink,.metadata.creationTimestamp,.metadata.annotations,.metadata.generation,.metadata.ownerReferences,.status)' | yq eval . --prettyPrint > $BACKUP_TARGET\nkubectl -n argocd get secrets -o=json | jq 'del(.metadata.resourceVersion,.metadata.uid,.metadata.selfLink,.metadata.creationTimestamp,.metadata.annotations,.metadata.generation,.metadata.ownerReferences,.status)' | yq eval . --prettyPrint >> $BACKUP_TARGET \nkubectl -n argocd get app -o=json | jq 'del(.metadata.resourceVersion,.metadata.uid,.metadata.selfLink,.metadata.creationTimestamp,.metadata.annotations,.metadata.generation,.metadata.ownerReferences,.status)' | yq eval . --prettyPrint >> $BACKUP_TARGET \nkubectl -n argocd get appproj -o=json | jq 'del(.metadata.resourceVersion,.metadata.uid,.metadata.selfLink,.metadata.creationTimestamp,.metadata.annotations,.metadata.generation,.metadata.ownerReferences,.status)' | yq eval . --prettyPrint >> $BACKUP_TARGET<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"
Since kubectl –export is deprecated it is possible to do something like this. WARNING: I have not tested this #!\/bin\/bash<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119,1],"tags":[],"class_list":["post-1888","post","type-post","status-publish","format-standard","hentry","category-kubernetes","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=1888"}],"version-history":[{"count":1,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1888\/revisions"}],"predecessor-version":[{"id":1889,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1888\/revisions\/1889"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=1888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=1888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=1888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}