Kubernetes 自动缩放和堆问题
Kubernetes autoscaling and heapster issues
我正在尝试在我的 kubernetes 集群中设置自动缩放。在为它部署 heapster 和服务之后。我面临以下错误。
horizontal.go:99] Failed to reconcile nginx: failed to compute desired number of replicas based on CPU utilization for Deployment/default/nginx: failed to get CPU utilization: failed to get CPU consumption and request: failed to unmarshall heapster response: json: cannot unmarshal object into Go value of type []v1alpha1.PodMetrics
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: I0909 18:15:37.432445 27951 horizontal.go:403] Successfully updated status for nginx
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: ]
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: ]
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "memory": "1512Ki"
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "cpu": "0",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "usage": {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "name": "nginx",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "containers": [
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "window": "1m0s",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "timestamp": "2016-09-09T18:15:00Z",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: },
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "creationTimestamp": "2016-09-09T18:15:37Z"
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "namespace": "default",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "name": "nginx-24809263-3idn3",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "metadata": {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "items": [
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "metadata": {},
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: I0909 18:15:37.424164 27951 metrics_client.go:166] Heapster metrics result: {
Heapster 成功地从 pod 中提取指标并且在
上可用
{
"metadata": {},
"items": [
{
"metadata": {
"name": "nginx-24809263-3idn3",
"namespace": "default",
"creationTimestamp": "2016-09-10T02:57:03Z"
},
"timestamp": "2016-09-10T02:56:00Z",
"window": "1m0s",
"containers": [
{
"name": "nginx",
"usage": {
"cpu": "0",
"memory": "1400Ki"
}
}
]
}
]
}
我 运行 遇到所有 heapster 版本的这个问题(heapster:canary,v1.2.0-beta.2,v1.1.0)
下面是关于我的环境的更多详细信息
Kubernetes 版本
客户端版本:version.Info{主要:“1”,次要:“3”,GitVersion:"v1.3.5",GitCommit:"b0deb2eb8f4037421077f77cb163dbb4c0a2a9f5",GitTreeState:"clean",BuildDate:“2016- 08-11T20:29:08Z",GoVersion:"go1.6.2",编译器:"gc",平台:"linux/amd64"}
服务器版本:version.Info{主要:“1”,次要:“3”,GitVersion:"v1.3.5",GitCommit:"b0deb2eb8f4037421077f77cb163dbb4c0a2a9f5",GitTreeState:"clean",BuildDate:“2016- 08-11T20:21:58Z",GoVersion:"go1.6.2",编译器:"gc",平台:"linux/amd64"}
Custom/On-Premise 集群
OS(例如来自 /etc/os-release):NAME="CentOS Linux" VERSION="7(核心)"
内核(例如 uname -a):Linux dev1-132869446-3-157772786 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
中的建议没有解决问题
这是因为版本不匹配 Kubernetes 1.3.5 与 Heapster v1.1.0-beta2 兼容
我正在尝试在我的 kubernetes 集群中设置自动缩放。在为它部署 heapster 和服务之后。我面临以下错误。
horizontal.go:99] Failed to reconcile nginx: failed to compute desired number of replicas based on CPU utilization for Deployment/default/nginx: failed to get CPU utilization: failed to get CPU consumption and request: failed to unmarshall heapster response: json: cannot unmarshal object into Go value of type []v1alpha1.PodMetrics
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: I0909 18:15:37.432445 27951 horizontal.go:403] Successfully updated status for nginx
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: ]
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: ]
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: }
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "memory": "1512Ki"
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "cpu": "0",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "usage": {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "name": "nginx",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "containers": [
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "window": "1m0s",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "timestamp": "2016-09-09T18:15:00Z",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: },
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "creationTimestamp": "2016-09-09T18:15:37Z"
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "namespace": "default",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "name": "nginx-24809263-3idn3",
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "metadata": {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: {
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "items": [
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: "metadata": {},
Sep 09 18:15:37 dev1-132869446-3-157772786 kube-controller-manager[27951]: I0909 18:15:37.424164 27951 metrics_client.go:166] Heapster metrics result: {
Heapster 成功地从 pod 中提取指标并且在
上可用{
"metadata": {},
"items": [
{
"metadata": {
"name": "nginx-24809263-3idn3",
"namespace": "default",
"creationTimestamp": "2016-09-10T02:57:03Z"
},
"timestamp": "2016-09-10T02:56:00Z",
"window": "1m0s",
"containers": [
{
"name": "nginx",
"usage": {
"cpu": "0",
"memory": "1400Ki"
}
}
]
}
]
}
我 运行 遇到所有 heapster 版本的这个问题(heapster:canary,v1.2.0-beta.2,v1.1.0)
下面是关于我的环境的更多详细信息
Kubernetes 版本 客户端版本:version.Info{主要:“1”,次要:“3”,GitVersion:"v1.3.5",GitCommit:"b0deb2eb8f4037421077f77cb163dbb4c0a2a9f5",GitTreeState:"clean",BuildDate:“2016- 08-11T20:29:08Z",GoVersion:"go1.6.2",编译器:"gc",平台:"linux/amd64"} 服务器版本:version.Info{主要:“1”,次要:“3”,GitVersion:"v1.3.5",GitCommit:"b0deb2eb8f4037421077f77cb163dbb4c0a2a9f5",GitTreeState:"clean",BuildDate:“2016- 08-11T20:21:58Z",GoVersion:"go1.6.2",编译器:"gc",平台:"linux/amd64"}
Custom/On-Premise 集群
OS(例如来自 /etc/os-release):NAME="CentOS Linux" VERSION="7(核心)" 内核(例如 uname -a):Linux dev1-132869446-3-157772786 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
这是因为版本不匹配 Kubernetes 1.3.5 与 Heapster v1.1.0-beta2 兼容