溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

kubectl top插件的安裝方法

發(fā)布時(shí)間:2021-08-30 18:52:01 來源:億速云 閱讀:445 作者:chen 欄目:系統(tǒng)運(yùn)維

這篇文章主要講解了“kubectl top插件的安裝方法”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“kubectl top插件的安裝方法”吧!

1.下載yaml 文件

wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/auth-delegator.yaml
wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/metrics-server-service.yaml
wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/auth-reader.yaml
wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/metrics-apiservice.yaml
wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/metrics-server-deployment.yaml
wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/aggregated-metrics-reader.yaml
wget http://pencil-file.oss-cn-hangzhou.aliyuncs.com/blog/resource-reader.yaml

2. 修改metrics-server-deployment.yaml文件

核心配置:

 containers:
      - name: metrics-server
        image: k8s.gcr.io/metrics-server-amd64:v0.3.2
        imagePullPolicy: IfNotPresent
        #修改為本地有鏡像優(yōu)先使用
        command:
        - /metrics-server
        - --metric-resolution=30s
        - --kubelet-insecure-tls
        - --kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS,ExternalIP
        #容器的預(yù)設(shè)值 腳本
        volumeMounts:
        - name: tmp-dir
          mountPath: /tmp

3.拉取鏡像

docker pull k8s.gcr.io/metrics-server-amd64
由于該鏡像在國外所以可能使用其他途徑 代理上網(wǎng)或者本地導(dǎo)入
代理上網(wǎng)法

mkdir -p /etc/systemd/system/docker.service.d
#創(chuàng)建放代理的文件夾,默認(rèn)沒有
echo '[Service]
Environment="HTTP_PROXY=192.168.0.26:8118" "HTTPS_PROXY=192.168.0.26:8118"' >/etc/systemd/system/docker.service.d/http-proxy.conf
#創(chuàng)建代理的配置件,前提得有能訪問到國外鏡像服務(wù)器的代理服務(wù)器
systemctl daemon-reload
systemctl restart docker
#重啟docker

以上腳本運(yùn)行一下 就能pull 到國外鏡像了

本地導(dǎo)出導(dǎo)入法
先到拉取完畢的主機(jī)上導(dǎo)出
docker save -o metrics-server-amd64:v0.3.2.tar k8s.gcr.io/metrics-server-amd64:v0.3.2
#.tar 為完成的打包文件,后面的是需要導(dǎo)出的鏡像名需要帶版本名,鏡像名用docker images 查看
導(dǎo)入
docker load <metrics-server-amd64\:v0.3.2.tar

4.應(yīng)用
kubectl apply -f ./
#應(yīng)用下載的所有yaml文件
kubectl get pod -n kube-system
#查看一下pod 是否正常
kubectl top插件的安裝方法

感謝各位的閱讀,以上就是“kubectl top插件的安裝方法”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對kubectl top插件的安裝方法這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI