양상헌:
Anyone can answer for this question in lighting lab,please?
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.
Example:
DEPLOYMENT CONTAINER_IMAGE READY_REPLICAS NAMESPACE
deploy0 nginx:alpine 1 admin2406
Write the result to the file /opt/admin2406_data.
Hint: Make use of -o custom-columns and --sort-by to print the data in the required format.
kubectl get pods -A -o=custom-columns=‘DATA:spec.containers[*].image’
so I tried like below but lighting lab got error…
DEPLOYMENT:metadata.namespace
CONTAINER_IMAGE:spec.containers[*].image
READY_REPLICAS:spec.replicas
NAMESPACE:metadata.namespace
DEPLOYMENT:metadata.namespace,CONTAINER_IMAGE:spec.containers[*].image,READY_REPLICAS:spec.replicas,NAMESPACE:metadata.namespace
so my answer is like ;
kubectl get deploypods -n admin2406 -o=custom-columns=‘DEPLOYMENT:metadata.namespace,CONTAINER_IMAGE:spec.containers[*].image,READY_REPLICAS:spec.replicas,NAMESPACE:metadata.namespace’
is this correct, or correct me…thanks in advance.