Metrics Server là một dịch vụ chắc chắn sẽ phải cài.
Vì để tính năng HPA work well thì phải có metrics-server
Dưới đây là một số ảnh minh họa.
1) Introduce Metrics Server
2) Install Metrics Server on k8s
Việc cài đặt Vô cùng đơn giản.
https://github.com/kubernetes-sigs/metrics-server
Bạn apply file manifest sau:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
Giờ bạn gõ command để nhìn thấy kết quả:
PS C:\Users\thang.tran> kubectl.exe top pod -n argocd NAME CPU(cores) MEMORY(bytes) argocd-application-controller-0 29m 257Mi argocd-applicationset-controller-bbf48bd7c-s8g6q 1m 22Mi argocd-dex-server-7d757d85d5-s6jr2 1m 25Mi argocd-image-updater-595cbb8699-m2t8q 2m 35Mi argocd-notifications-controller-7b7c9854dd-77287 1m 20Mi argocd-redis-65596bf87-xcwdl 2m 14Mi argocd-repo-server-c996ccd4-bbrxb 4m 54Mi argocd-server-86576f9c7d-n7gj7 1m 43Mi busybox-deployment-6fcbfb5d48-dz56c 0m 0Mi
3) Pay attention to installing the Metrics Server on EKS
Bạn sẽ bị lỗi này:
kubectl describe apiservice v1beta1.metrics.k8s.io Message: failing or missing response from https://IPAddress:4443/apis/metrics.k8s.io/v1beta1: 7 Get https://IPAddress:4443/apis/metrics.k8s.io/v1beta1: 7 net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) Reason: FailedDiscoveryCheck
Do là bạn chưa mở Security Group
# Extend node-to-node security group rules node_security_group_ntp_ipv4_cidr_block = ["169.254.169.123/32"] node_security_group_additional_rules = { ingress_self_all = { description = "Node to node all ports/protocols" protocol = "-1" from_port = 0 to_port = 0 type = "ingress" self = true } egress_all = { description = "Node all egress" protocol = "-1" from_port = 0 to_port = 0 type = "egress" cidr_blocks = ["0.0.0.0/0"] ipv6_cidr_blocks = ["::/0"] } ## Security Group for Metrics Server ingress_cluster_metricserver = { description = "Cluster to node 4443 (Metrics Server)" protocol = "tcp" from_port = 4443 to_port = 4443 type = "ingress" source_cluster_security_group = true } #https://github.com/kubernetes-sigs/metrics-server/issues/448 }
https://github.com/kubernetes-sigs/metrics-server/issues/448