This might be the issue how you setup metrics-server and metrics-server could not able to find your resources on InternalIP.
The solution is to replace the metrics-server-deployment.yaml
file in metrics-server/deploy/1.8+
with the following yaml file:
apiVersion: v1
kind: ServiceAccount
metadata:
name: metrics-server
namespace: kube-system
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: metrics-server
namespace: kube-system
labels:
k8s-app: metrics-server
spec:
selector:
matchLabels:
k8s-app: metrics-server
template:
metadata:
name: metrics-server
labels:
k8s-app: metrics-server
spec:
serviceAccountName: metrics-server
volumes:
# mount in tmp so we can safely use from-scratch images and/or read-only containers
- name: tmp-dir
emptyDir: {}
containers:
- command:
- /metrics-server
- --metric-resolution=30s
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
name: metrics-server
image: k8s.gcr.io/metrics-server-amd64:v0.3.1
imagePullPolicy: Always
volumeMounts:
- name: tmp-dir
mountPath: /tmp
Also, enable the --authentication-token-webhook
in kubelet.conf
, then you will be able to get the metrics.
Also, checkout my answer for step by step instruction to set the HPA using metrics-server.
How to Enable KubeAPI server for HPA Autoscaling Metrics
Hope this helps. Revert back if you face any issues.