自己做網(wǎng)站教學(xué)視頻seo網(wǎng)站優(yōu)化經(jīng)理
項(xiàng)目場(chǎng)景:
需要開(kāi)啟指標(biāo)服務(wù),依據(jù)pod 的 cpu、內(nèi)存使用率進(jìn)行自動(dòng)的擴(kuò)容或縮容 pod 的數(shù)量
解決方案:
下載 metrics-server 組件配置文件:
wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml -O components.yaml
修改components.yaml配置文件,在 containers 的 args 參數(shù)中增加 --kubelet-insecure-tls
參數(shù):
docker無(wú)法拉取鏡像,先拉取到本地,yaml中配置的imagePullPolicy策略為IfNotPresent
優(yōu)先使用本地鏡像:
docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/registry.k8s.io/metrics-server/metrics-server:v0.7.1docker tag swr.cn-north-4.myhuaweicloud.com/ddn-k8s/registry.k8s.io/metrics-server/metrics-server:v0.7.1 registry.k8s.io/metrics-server/metrics-server:v0.7.1
按照組件:
kubectl apply -f components.yaml
查看pod狀態(tài)
kubectl get pods --all-namespaces | grep metrics
查看所有pod的資源使用情況:
kubectl top pods -A