← 返回命令列表

Linux command

kubectl-autoscale 命令

趣味

复制后可按需替换文件名、目录或参数。

常用示例

Create HPA for deployment

kubectl autoscale deployment [name] --min=[2] --max=[10] --cpu-percent=[80]

Autoscale replication controller

kubectl autoscale rc [name] --max=[5]

Create HPA with specific name

kubectl autoscale deployment [name] --name=[hpa-name] --max=[10]

说明

kubectl autoscale creates a Horizontal Pod Autoscaler (HPA) for a deployment, replica set, or replication controller. Automatically scales the number of pods based on CPU utilization or custom metrics.

参数

--min _count_
Minimum number of replicas.
--max _count_
Maximum number of replicas.
--cpu-percent _percent_
Target CPU utilization percentage.
--name _name_
Name for the HPA resource.
-n, --namespace _name_
Kubernetes namespace.

FAQ

What is the kubectl-autoscale command used for?

kubectl autoscale creates a Horizontal Pod Autoscaler (HPA) for a deployment, replica set, or replication controller. Automatically scales the number of pods based on CPU utilization or custom metrics.

How do I run a basic kubectl-autoscale example?

Run `kubectl autoscale deployment [name] --min=[2] --max=[10] --cpu-percent=[80]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --min _count_ do in kubectl-autoscale?

Minimum number of replicas.