Kubernetes CKA sample exam question 53 with answer

Question
There are various pods in all namespaces. Write a command into /opt/course/5/find_pods.sh which lists all pods sorted by their age (metadata.creationTimestamp)
Write a second command into /opt/course/5/find_pods_uid.sh which lists all pods sorted by field metadata.uid. Use kubectl sorting for both commands.

Answer
Execute first task:

kubectl get po -A --sort-by=.metadata.creationTimestamp
echo "kubectl get po -A --sort-by=.metadata.creationTimestamp" > /opt/course/5/find_pods.sh
And the second task:
kubectl get po -A --sort-by=.metadata.uid
echo "kubectl get po -A --sort-by=.metadata.uid" > /opt/course/5/find_pods_uid.sh
Verify:
bash /opt/course/5/find_pods.sh
bash /opt/course/5/find_pods_uid.sh