Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes 库伯内特斯自动标定_Kubernetes_Prometheus_Autoscaling - Fatal编程技术网

Kubernetes 库伯内特斯自动标定

Kubernetes 库伯内特斯自动标定,kubernetes,prometheus,autoscaling,Kubernetes,Prometheus,Autoscaling,我的集群上安装了Kubernetes v1.12.1。 我从以下repo下载了metrics服务器: 然后运行以下命令: kubectl create -f metrics-server/deploy/1.8+/ 然后我尝试使用以下工具自动调整部署: kubectl autoscale deployment example-app-tier --min 1 --max 3 --cpu-percent 70 --spacename example 但这里的目标显示未知/70% kubectl

我的集群上安装了Kubernetes v1.12.1。 我从以下repo下载了metrics服务器:

然后运行以下命令:

kubectl create -f metrics-server/deploy/1.8+/
然后我尝试使用以下工具自动调整部署:

kubectl autoscale deployment example-app-tier --min 1 --max 3 --cpu-percent 70 --spacename example
但这里的目标显示未知/70%

kubectl get hpa --spacename example
NAMESPACE   NAME               REFERENCE                     TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
example example-app-tier   Deployment/example-app-tier   <unknown>/70%   1         3         1          3h35m
因此,我正在寻找任何教程,帮助我使用metrics server或Prometheus逐步启用自动缩放(而不是Heapster,因为它已被弃用,不再受支持)


谢谢大家!

您需要向API服务器注册度量服务器,并确保它们能够通信

如果已经完成,您需要检查k8s版本中kubectl top命令的帮助,该命令可能默认使用heapster,您可能需要告诉它改用新服务

从help命令看,它似乎还没有被移植到新的metric服务器,默认情况下仍在寻找heapster

C02W84XMHTD5:tmp iahmad$ kubectl top node --help
Display Resource (CPU/Memory/Storage) usage of nodes. 

The top-node command allows you to see the resource consumption of nodes.

Aliases:
node, nodes, no

Examples:
  # Show metrics for all nodes
  kubectl top node

  # Show metrics for a given node
  kubectl top node NODE_NAME

Options:
      --heapster-namespace='kube-system': Namespace Heapster service is located in
      --heapster-port='': Port name in service to use
      --heapster-scheme='http': Scheme (http or https) to connect to Heapster as
      --heapster-service='heapster': Name of Heapster service
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l
key1=value1,key2=value2)

Usage:
  kubectl top node [NAME | -l label] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

注意:我使用的是1.10,可能在您的版本中,选项不同

因此,如果top命令以v1beta1.metrics.k8s.io的名称出现在apiservices列表中,我应该如何运行top命令使其链接到metrics服务器?
C02W84XMHTD5:tmp iahmad$ kubectl top node --help
Display Resource (CPU/Memory/Storage) usage of nodes. 

The top-node command allows you to see the resource consumption of nodes.

Aliases:
node, nodes, no

Examples:
  # Show metrics for all nodes
  kubectl top node

  # Show metrics for a given node
  kubectl top node NODE_NAME

Options:
      --heapster-namespace='kube-system': Namespace Heapster service is located in
      --heapster-port='': Port name in service to use
      --heapster-scheme='http': Scheme (http or https) to connect to Heapster as
      --heapster-service='heapster': Name of Heapster service
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l
key1=value1,key2=value2)

Usage:
  kubectl top node [NAME | -l label] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).