[root@dce-10-23-152-33 ~]# kubectl autoscale deployment my-nginx --cpu-percent=50 --min=1 --max=10
Error from server (NotFound): deployments.apps "my-nginx" not found
出现原因是由于没有为my-nginx的deployment,创建你的deployment即可解决:
[root@dce-172-30-40-237 tmp]# kubectl create deployment my-nginx --image=busybox
deployment.apps/my-nginx created
再执行,执行成功
[root@dce-172-30-40-237 tmp]# kubectl autoscale deployment my-nginx --cpu-percent=50 --min=1 --max=10
horizontalpodautoscaler.autoscaling/my-nginx autoscaled