A
A
alisherchikkk2021-11-22 08:21:54
ubuntu
alisherchikkk, 2021-11-22 08:21:54

How to upload json content of deployments in Kubernetes?

Good afternoon. There are 56 deployments in Kuber and you need to upload the contents of each to a txt file. Tell me, how can I upload the json content of all deployments to Kubernetes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
paran0id, 2021-11-22
@alisherchikkk

for d in `kubectl -n your-namespace get deployments | grep -v NAME | awk '{print $1}'`; do kubectl -n your-namespace get deployment $d -o json > $d.json; done

or
for d in `kubectl -n your-namespace get deployments -o=name | cut -f2 -d'/'`; do kubectl -n your-namespace get deployment $d -o json > $d.json; done

and you can do everything in one file, even easier:
kubectl -n your-namespace get deployments -o json > deployments.json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question