Use context: kubectl config use-context k8s-c1-H
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.
译文:
在所有命名空间中都有各种Pod。在 /opt/course/5/find_pods.sh 中写一条命令,列出所有按AGE(metadata.createTimestamp)排序的Pod。
在 /opt/course/5/find_pods_uid.sh 中编写第二条命令,列出所有按 metadata.uid 领域排序的Pod。两个命令都使用 kubectl 排序。
解答:
kubectl get pod -A --sort-by=.metadata.creationTimestamp
echo "kubectl get pod -A --sort-by=.metadata.creationTimestamp" > /opt/course/5/find_pods.sh
bash /opt/course/5/find_pods.sh
echo "kubectl get pod -A --sort-by=.metadata.uid" > /opt/course/5/find_pods_uid.sh
bash /opt/course/5/find_pods_uid.sh