Kubernetes CKA sample exam question 80 with answer

Question
Print the names of all deployments in the admin2406 namespace in the following format:

DEPLOYMENT		CONTAINER_IMAGE 		READY_REPLICAS 		NAMESPACE
deployment_name		container_image_used 		ready_replica_count 	namespace
The data should be sorted by the increasing order of the deployment name.
Write the result to the file /opt/admin2406_data

Answer
Generate the answer step by step, for this we will need:
kubectl -n admin2406 get deploy -o json
kubectl -n admin2406 get deploy -o='custom-columns=DEPLOYMENT:.metadata.name,CONTAINER_IMAGE:.spec.template.spec.containers[].name,READY_REPLICAS:.status.readyReplicas,NAMESPACE:.metadata.namespace'
kubectl -n admin2406 get deploy -o='custom-columns=DEPLOYMENT:.metadata.name,CONTAINER_IMAGE:.spec.template.spec.containers[].name,READY_REPLICAS:.status.readyReplicas,NAMESPACE:.metadata.namespace' --sort-by=.metadata.name
kubectl -n admin2406 get deploy -o='custom-columns=DEPLOYMENT:.metadata.name,CONTAINER_IMAGE:.spec.template.spec.containers[].name,READY_REPLICAS:.status.readyReplicas,NAMESPACE:.metadata.namespace' --sort-by=.metadata.name > /opt/admin2406_data