How to deploy metric server on k8s
To enable onboard Horizontal Autoscaling feature, a Metric Server needs to be installed first for k8s to pull resource data from.
helm install stable/metrics-server -n metric --namespace kube-system -f metric.yml
Metric Server has a chart on Helm stable, but somehow new version of it behaves weirdly, it shows error as:
unable to fetch pod metrics for pod rook-ceph/csi-rbdplugin-qv94k: no metrics known for pod
When this happens, it means you are facing some TLS and network issues. k8s Dashboard used to use port 10255 to pull data from nodes, this is insecure link, now they tend to use metric server to bypass this security concern. And to make it work, metric server needs to have following value ready:
- '--kubelet-insecure-tls'in args.
hostNetworkenabled in value.yml for Helm Chart or
hostNetwork: truein deployment yml if you are using complex CNI such as weave.
hostNetwork: true in customized
rbac: # Specifies whether RBAC resources should be created create: true pspEnabled: false serviceAccount: # Specifies whether a ServiceAccount should be created create: true # The name of the ServiceAccount to use. # If not set and create is true, a name is generated using the fullname template name: apiService: # Specifies if the v1beta1.metrics.k8s.io API service should be created. # # You typically want this enabled! If you disable API service creation you have to # manage it outside of this chart for e.g horizontal pod autoscaling to # work with this release. create: true hostNetwork: # Specifies if metrics-server should be started in hostNetwork mode. # # You would require this enabled if you use alternate overlay networking for pods and # API server unable to communicate with metrics-server. As an example, this is required # if you use Weave network on EKS enabled: true