I tried with the below command but it provides only the created date. How do I get when was it last updated?
kubectl describe hpa -n xyz hpa-hello
Example: Today I create a hpa with max replica 3 and tomorrow I apply the same yaml but with max replica 6. If I do that, I can see only the created date and not the updated date. The description correctly shows the updated max replicas as 6
Update: There is no direct way to obtain this information !
CodePudding user response:
I Assume here that the last updated date or time nothing but when was last auto scaled? To get details about the Horizontal Pod Autoscaler, you can use kubectl get hpa with the -o yaml flag. The status field contains information about the current number of replicas and any recent autoscaling events.
kubectl get hpa <hpa name> -o yaml
In this output we can see the last transition times along with messages. Refer to this doc which might help you and also to view the details about the HPA.
Edit 1: Moreover, I have gone through many docs and I don't think we can get the info about it from a get command. For this, an auditing resource in k8's can be created to log all activities generated by users for a specific type of resource . This might help you to find the logs.