在CentOS上扩展K8s部署,可从扩展节点和扩展应用两方面着手,具体如下:
kubeadm token create --print-join-command
生成加入命令,在新节点上执行该命令,将新节点加入集群。kubectl get nodes
检查新节点是否成功加入且状态为Ready。kubectl create deployment
命令创建。kubectl autoscale deployment <deployment-name> --cpu-percent=<value> --min=<min-replicas> --max=<max-replicas>
命令创建,根据CPU使用率自动扩缩Pod副本数。kubectl describe hpa <hpa-name>
查看HPA状态,确保其按预期工作。