[英]install heapster or metric server in kubernetes for horizontal pod autoscaling
how to install heapster or metric server to get pod metrics in kubernetes.如何在 kubernetes 中安装 heapster 或 metric 服务器以获取 pod 指标。 I need those pod metrics for using it to horizontal pod auto-scaling.
我需要这些 pod 指标以将其用于水平 pod 自动缩放。 I'm using Digital Ocean cloud cluster.
我正在使用 Digital Ocean 云集群。 deployment file is in the screenshot below
部署文件在下面的屏幕截图中
You need to first download the following files:您需要先下载以下文件:
curl https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/grafana.yaml > grafana.yaml
curl https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/heapster.yaml > heapster.yaml
curl https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/influxdb/influxdb.yaml > influxdb.yaml
curl https://raw.githubusercontent.com/kubernetes/heapster/master/deploy/kube-config/rbac/heapster-rbac.yaml > heapster-rbac.yaml
Then create the following service instance of grafana, influxdb and heapster:然后创建以下grafana、influxdb和heapster的服务实例:
$ kubectl create -f grafana.yaml
deployment "monitoring-grafana" created
service "monitoring-grafana" created
$ kubectl create -f heapster.yaml
serviceaccount "heapster" created
deployment "heapster" created
service "heapster" created
$ kubectl create -f influxdb.yaml
deployment "monitoring-influxdb" created
service "monitoring-influxdb" created
$ kubectl create -f heapster-rbac.yaml
clusterrolebinding "heapster" created
Follow this tutorial for test your autoscaling pods:按照本教程测试您的自动缩放 pod:
https://developer.ibm.com/tutorials/autoscale-application-on-kubernetes-cluster/ https://developer.ibm.com/tutorials/autoscale-application-on-kubernetes-cluster/
Hope this helps.希望这可以帮助。
EDIT: Resource request in your deployment file:编辑:部署文件中的资源请求:
apiVersion: v1
kind: Pod
metadata:
name: frontend
spec:
containers:
- name: db
image: mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: "password"
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
- name: wp
image: wordpress
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
resources and request should be there in your deployment files so that HPA can access it to autoscale.资源和请求应该在您的部署文件中,以便 HPA 可以访问它以自动缩放。
Heapster is Deprecated in Latest Kubernetes. Heapster 在最新的 Kubernetes 中已弃用。 Fetching metrics from Heapster is deprecated as of Kubernetes 1.11.
从 Kubernetes 1.11 开始,不推荐从 Heapster 获取指标。
Installing with metrics-server worked for me :使用 metrics-server 安装对我有用:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
Source :来源 :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.