To install metrics-server from GitHub on an Amazon EKS cluster using a web browserDownload and extract the latest version of the metrics server code from GitHub.Navigate to the latest release page of the metrics-server project on GitHub metrics-server, then choose a source code archive for the latest release to download it.
NoteIf you are downloading to a remote server, you can use the following curl command, substituting the red text with the latest version number.
curl -o v0.3.6.tar.gz https://github.com/kubernetes-sigs/metrics-server/archive/v0.3.6.tar.gz
Navigate to your downloads location and extract the source code archive. For example, if you downloaded the .tar.gz archive, use the following command to extract (substituting your release version).
tar -xzf v0.3.6.tar.gz
Apply all of the YAML manifests in the metrics-server-0.3.6/deploy/1.8+ directory (substituting your release version).
kubectl apply -f metrics-server-0.3.6/deploy/1.8+/
Verify that the metrics-server deployment is running the desired number of pods with the following command.
kubectl get deployment metrics-server -n kube-systemOutput:
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
metrics-server 1 1 1 1 56m
需要修改deployment配置如下
- name: tmp-dir
emptyDir:
sizeLimit: 64Mi
containers:
- name: metrics-server
image: k8s.gcr.io/metrics-server-amd64:v0.3.6
imagePullPolicy: IfNotPresent
args:
- --kubelet-preferred-address-types=InternalIP,Hostname
- --kubelet-insecure-tls
是metrics-server這個容器不能通過CoreDNS 10.96.0.10:53 解析各Node的主機名,metrics-server連節點時默認是連接節點的主機名,需要加個參數,讓它連接節點的IP,同時因爲10250是https端口,連接它時需要提供證書,所以加上–kubelet-insecure-tls,表示不驗證客戶端證書
sizeLimit 設置空目錄佔用內存大小,pod長期不重啓,容器輸出到 emptydir 的日誌文件設置限制