Skip to content

Commit

Permalink
Merge branch 'master' into release-1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
brancz committed Jan 11, 2019
2 parents c56e5ee + a38c84f commit c888603
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: required
language: go

go:
- "1.11.2"
- "1.11.4"

install:
- mkdir -p $HOME/gopath/src/k8s.io
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
## v1.5.0 / 2019-01-10

After a testing period of 30 days, there were no additional bugs found or features introduced. Due to no bugs being reported over an in total 41 days period, we feel no more pre-releases are necessary for a stable release.

This release's focus was a large architectural change in order to improve performance and resource usage of kube-state-metrics drastically. Special thanks to @mxinden for his hard work on this! See the changelog of the pre-releases for more detailed information and related pull requests.

An additional change has been requested to be listed in the release notes:

* [CHANGE] Due to removal of the surrounding mechanism the `ksm_resources_per_scrape` and `ksm_scrape_error_total` metrics no longer exists.

## v1.5.0-beta.0 / 2018-12-11

After a testing period of 11 days, there were no additional bugs found or features introduced.

## v1.5.0-alpha.0 / 2018-11-30

* [CHANGE] Disable gzip compression of kube-state-metrics responses by default. Can be re-enabled via `--enable-gzip-encoding`. See #563 for more details.
* [FEATURE] Add `kube_replicatset_owner` metric (#520).
* [FEATURE] Add `kube_replicaset_owner` metric (#520).
* [FEATURE] Add `kube_pod_container_status_last_terminated_reason` metric (#535).
* [FEATURE] Add `stateful_set_status.{current,update}_revision` metric (#545).
* [FEATURE] Add pod disruption budget collector (#551).
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM alpine:3.7
FROM alpine:3.8

COPY kube-state-metrics /

ENTRYPOINT ["/kube-state-metrics", "--port=8080", "--telemetry-port=8081"]

EXPOSE 8080
EXPOSE 8081
EXPOSE 8080 8081
26 changes: 13 additions & 13 deletions Documentation/job-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

| Metric name| Metric type | Labels/tags | Status |
| ---------- | ----------- | ----------- | ----------- |
| kube_job_info | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_labels | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `label_JOB_LABEL`=&lt;JOB_LABEL&gt; | STABLE |
| kube_job_spec_parallelism | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_spec_completions | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_spec_active_deadline_seconds | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_active | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_succeeded | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_failed | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_start_time | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_completion_time | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_complete | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_failed | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_created | Gauge | `job`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_info | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_labels | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; <br> `label_JOB_LABEL`=&lt;JOB_LABEL&gt; | STABLE |
| kube_job_spec_parallelism | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_spec_completions | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_spec_active_deadline_seconds | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_active | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_succeeded | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_failed | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_start_time | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_status_completion_time | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_complete | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_failed | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
| kube_job_created | Gauge | `job_name`=&lt;job-name&gt; <br> `namespace`=&lt;job-namespace&gt; | STABLE |
2 changes: 1 addition & 1 deletion Documentation/node-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| Metric name| Metric type | Labels/tags | Status |
| ---------- | ----------- | ----------- | ----------- |
| kube_node_info | Gauge | `node`=&lt;node-address&gt; <br> `kernel_version`=&lt;kernel-version&gt; <br> `os_image`=&lt;os-image-name&gt; <br> `container_runtime_version`=&lt;container-runtime-and-version-combination&gt; <br> `kubelet_version`=&lt;kubelet-version&gt; <br> `kubeproxy_version`=&lt;kubeproxy-version&gt; | STABLE |
| kube_node_info | Gauge | `node`=&lt;node-address&gt; <br> `kernel_version`=&lt;kernel-version&gt; <br> `os_image`=&lt;os-image-name&gt; <br> `container_runtime_version`=&lt;container-runtime-and-version-combination&gt; <br> `kubelet_version`=&lt;kubelet-version&gt; <br> `kubeproxy_version`=&lt;kubeproxy-version&gt; <br> `provider_id`=&lt;provider-id&gt; | STABLE |
| kube_node_labels | Gauge | `node`=&lt;node-address&gt; <br> `label_NODE_LABEL`=&lt;NODE_LABEL&gt; | STABLE |
| kube_node_spec_unschedulable | Gauge | `node`=&lt;node-address&gt;|
| kube_node_spec_taint | Gauge | `node`=&lt;node-address&gt; <br> `key`=&lt;taint-key&gt; <br> `value=`&lt;taint-value&gt; <br> `effect=`&lt;taint-effect&gt; | STABLE |
Expand Down
4 changes: 2 additions & 2 deletions Documentation/pod-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

| Metric name| Metric type | Labels/tags | Status |
| ---------- | ----------- | ----------- | ----------- |
| kube_pod_info | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `host_ip`=&lt;host-ip&gt; <br> `pod_ip`=&lt;pod-ip&gt; <br> `node`=&lt;node-name&gt;<br> `created_by_kind`=&lt;created_by_kind&gt;<br> `created_by_name`=&lt;created_by_name&gt;<br> | STABLE |
| kube_pod_info | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `host_ip`=&lt;host-ip&gt; <br> `pod_ip`=&lt;pod-ip&gt; <br> `node`=&lt;node-name&gt;<br> `created_by_kind`=&lt;created_by_kind&gt;<br> `created_by_name`=&lt;created_by_name&gt;<br> `uid`=&lt;pod-uid&gt;| STABLE |
| kube_pod_start_time | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; |
| kube_pod_completion_time | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |
| kube_pod_owner | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `owner_kind`=&lt;owner kind&gt; <br> `owner_name`=&lt;owner name&gt; <br> `owner_is_controller`=&lt;whether owner is controller&gt; | STABLE |
Expand All @@ -12,7 +12,7 @@
| kube_pod_status_scheduled | Gauge | `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `condition`=&lt;true\|false\|unknown&gt; | STABLE |
| kube_pod_container_info | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `image`=&lt;image-name&gt; <br> `image_id`=&lt;image-id&gt; <br> `container_id`=&lt;containerid&gt; | STABLE |
| kube_pod_container_status_waiting | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |
| kube_pod_container_status_waiting_reason | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;ContainerCreating\|CrashLoopBackOff\|ErrImagePull\|ImagePullBackOff&gt; | STABLE |
| kube_pod_container_status_waiting_reason | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;ContainerCreating\|CrashLoopBackOff\|ErrImagePull\|ImagePullBackOff\|CreateContainerConfigError&gt; | STABLE |
| kube_pod_container_status_running | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |
| kube_pod_container_status_terminated | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; | STABLE |
| kube_pod_container_status_terminated_reason | Gauge | `container`=&lt;container-name&gt; <br> `pod`=&lt;pod-name&gt; <br> `namespace`=&lt;pod-namespace&gt; <br> `reason`=&lt;OOMKilled\|Error\|Completed\|ContainerCannotRun&gt; | STABLE |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BuildDate = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
Commit = $(shell git rev-parse --short HEAD)
ALL_ARCH = amd64 arm arm64 ppc64le s390x
PKG=k8s.io/kube-state-metrics/pkg
GO_VERSION=1.11.2
GO_VERSION=1.11.4

IMAGE = $(REGISTRY)/kube-state-metrics
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
Expand Down
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ the raw metrics.
- [Metrics Documentation](#metrics-documentation)
- [Kube-state-metrics self metrics](#kube-state-metrics-self-metrics)
- [Resource recommendation](#resource-recommendation)
- [kube-state-metrics vs. Heapster(metrics-server)](#kube-state-metrics-vs-heapstermetrics-server)
- [kube-state-metrics vs. metrics-server(Heapster)](#kube-state-metrics-vs-metrics-serverheapster)
- [Setup](#setup)
- [Building the Docker container](#building-the-docker-container)
- [Usage](#usage)
Expand All @@ -60,6 +60,7 @@ At most 5 kube-state-metrics releases will be recorded below.
| **v1.3.0** | v6.0.0 |||||
| **v1.3.1** | v6.0.0 |||||
| **v1.4.0** | v8.0.0 |||||
| **v1.5.0** | v8.0.0 |||||
| **master** | v8.0.0 |||||
- `` Fully supported version range.
- `-` The Kubernetes cluster has features the client-go library can't use (additional API objects, etc).
Expand All @@ -72,8 +73,8 @@ release.
#### Container Image

The latest container image can be found at:
* `quay.io/coreos/kube-state-metrics:v1.4.0`
* `k8s.gcr.io/kube-state-metrics:v1.4.0`
* `quay.io/coreos/kube-state-metrics:v1.5.0`
* `k8s.gcr.io/kube-state-metrics:v1.5.0`

**Note**:
The recommended docker registry for kube-state-metrics is `quay.io`. kube-state-metrics on
Expand Down Expand Up @@ -102,12 +103,7 @@ additional metrics!
See the [`Documentation`](Documentation) directory for more informations of the exposed metrics.

### Kube-state-metrics self metrics
kube-state-metrics exposes its own metrics under `--telemetry-host` and `--telemetry-port` (default 81).

| Metric name | Metric type | Description | Labels/tags |
| ----------- | ----------- | ----------- | ----------- |
| ksm_scrape_error_total | Counter | Total scrape errors encountered when scraping a resource | `resource`=&lt;resource name&gt; |
| ksm_resources_per_scrape | Summary | Number of resources returned per scrape | `resource`=&lt;resource name&gt; |
kube-state-metrics exposes its own general process metrics under `--telemetry-host` and `--telemetry-port` (default 81).

### Resource recommendation

Expand All @@ -132,32 +128,32 @@ These numbers are based on [scalability tests](https://github.com/kubernetes/kub

Note that if CPU limits are set too low, kube-state-metrics' internal queues will not be able to be worked off quickly enough, resulting in increased memory consumption as the queue length grows. If you experience problems resulting from high memory allocation, try increasing the CPU limits.

### kube-state-metrics vs. Heapster(metrics-server)
### kube-state-metrics vs. metrics-server(Heapster)

Heapster([metrics-server](https://github.com/kubernetes-incubator/metrics-server)) is a project which fetches
[metrics-server](https://github.com/kubernetes-incubator/metrics-server)(Heapster) is a project which fetches
metrics (such as CPU and memory utilization) from the Kubernetes API server and
nodes and sends them to various time-series backends such as InfluxDB or Google
Cloud Monitoring. Its most important function right now is implementing certain
metric APIs that Kubernetes components like the horizontal pod auto-scaler
query to make decisions.

While Heapster([metrics-server](https://github.com/kubernetes-incubator/metrics-server))'s focus is on forwarding metrics already generated by
While [metrics-server](https://github.com/kubernetes-incubator/metrics-server)(Heapster)'s focus is on forwarding metrics already generated by
Kubernetes, kube-state-metrics is focused on generating completely new metrics
from Kubernetes' object state (e.g. metrics based on deployments, replica sets,
etc.). The reason not to extend Heapster([metrics-server](https://github.com/kubernetes-incubator/metrics-server)) with kube-state-metrics' abilities is
because the concerns are fundamentally different: Heapster([metrics-server](https://github.com/kubernetes-incubator/metrics-server)) only needs to fetch,
etc.). The reason not to extend [metrics-server](https://github.com/kubernetes-incubator/metrics-server)(Heapster) with kube-state-metrics' abilities is
because the concerns are fundamentally different: [metrics-server](https://github.com/kubernetes-incubator/metrics-server)(Heapster) only needs to fetch,
format and forward metrics that already exist, in particular from Kubernetes
components, and write them into sinks, which are the actual monitoring
systems. kube-state-metrics, in contrast, holds an entire snapshot of
Kubernetes state in memory and continuously generates new metrics based off of
it but has no responsibility for exporting its metrics anywhere.

In other words, kube-state-metrics itself is designed to be another source for
Heapster([metrics-server](https://github.com/kubernetes-incubator/metrics-server)) (although this is not currently the case).
[metrics-server](https://github.com/kubernetes-incubator/metrics-server)(Heapster) (although this is not currently the case).

Additionally, some monitoring systems such as Prometheus do not use Heapster([metrics-server](https://github.com/kubernetes-incubator/metrics-server))
Additionally, some monitoring systems such as Prometheus do not use [metrics-server](https://github.com/kubernetes-incubator/metrics-server)(Heapster)
for metric collection at all and instead implement their own, but
[Prometheus can scrape metrics from heapster itself to alert on Heapster(metrics-server)'s health](https://kubernetes.io/docs/tasks/debug-application-cluster/core-metrics-pipeline/).
[Prometheus can scrape metrics from metrics-server(Heapster) itself to alert on metrics-server(Heapster)'s health](https://kubernetes.io/docs/tasks/debug-application-cluster/core-metrics-pipeline/).
Having kube-state-metrics as a separate project enables access to these metrics
from those monitoring systems.

Expand Down
3 changes: 1 addition & 2 deletions kubernetes/kube-state-metrics-cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: rbac.authorization.k8s.io/v1
apiVersion: rbac.authorization.k8s.io/v1
# kubernetes versions before 1.8.0 should use rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
Expand All @@ -11,4 +11,3 @@ subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace: kube-system

2 changes: 1 addition & 1 deletion kubernetes/kube-state-metrics-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
serviceAccountName: kube-state-metrics
containers:
- name: kube-state-metrics
image: quay.io/coreos/kube-state-metrics:v1.4.0
image: quay.io/coreos/kube-state-metrics:v1.5.0
ports:
- name: http-metrics
containerPort: 8080
Expand Down
1 change: 0 additions & 1 deletion kubernetes/kube-state-metrics-role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ subjects:
- kind: ServiceAccount
name: kube-state-metrics
namespace: kube-system

1 change: 0 additions & 1 deletion kubernetes/kube-state-metrics-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ rules:
- deployments
resourceNames: ["kube-state-metrics"]
verbs: ["get", "update"]

1 change: 0 additions & 1 deletion kubernetes/kube-state-metrics-service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ kind: ServiceAccount
metadata:
name: kube-state-metrics
namespace: kube-system

1 change: 0 additions & 1 deletion kubernetes/kube-state-metrics-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ spec:
protocol: TCP
selector:
k8s-app: kube-state-metrics

3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func main() {
glog.Info("Using default collectors")
collectorBuilder.WithEnabledCollectors(options.DefaultCollectors.AsSlice())
} else {
glog.Infof("Using collectors %s", opts.Collectors.String())
collectorBuilder.WithEnabledCollectors(opts.Collectors.AsSlice())
}

Expand Down Expand Up @@ -120,7 +121,7 @@ func main() {
})
}

glog.Infof("metric white- blacklisting: %v", whiteBlackList.Status())
glog.Infof("metric white-blacklisting: %v", whiteBlackList.Status())

collectorBuilder.WithWhiteBlackList(whiteBlackList)

Expand Down
9 changes: 0 additions & 9 deletions pkg/collectors/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func (b *Builder) Build() []*Collector {
activeCollectorNames = append(activeCollectorNames, c)
collectors = append(collectors, collector)
}
// TODO: What if not ok?
}

glog.Infof("Active collectors: %s", strings.Join(activeCollectorNames, ","))
Expand Down Expand Up @@ -494,14 +493,6 @@ func filterMetricFamilies(l whiteBlackLister, families []metrics.FamilyGenerator
return filtered
}

//
// func (b *Builder) buildStatefulSetCollector() *Collector {
// store := metricsstore.NewMetricsStore(generateStatefulSetMetrics)
// reflectorPerNamespace(b.ctx, b.kubeClient, &apps.StatefulSet{}, store, b.namespaces, createStatefulSetListWatch)
//
// return newCollector(store)
// }

// reflectorPerNamespace creates a Kubernetes client-go reflector with the given
// listWatchFunc for each given namespace and registers it with the given store.
func reflectorPerNamespace(
Expand Down

0 comments on commit c888603

Please sign in to comment.