Skip to content

Commit e36759e

Browse files
roffemurali-reddy
authored andcommitted
Documentation updates (#289)
* updated generic docs with some requirements added draft for metrics docs updated readme * more metrics docs * finishing touches * small touch to generic docs * some more touches * clarification when this function was added * enriching the doc with usefull links * last touch
1 parent c8c19e4 commit e36759e

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

Documentation/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ Usage of ./kube-router:
116116
--kubeconfig string Path to kubeconfig file with authorization information (the master location is set by the master flag).
117117
--masquerade-all SNAT all traffic to cluster IP/node port.
118118
--master string The address of the Kubernetes API server (overrides any value in kubeconfig).
119-
--metrics-port int Prometheus metrics port to use, ( default 8080 )
120-
--metrics-path string Path to serve Prometheus metrics on, ( default /metrics )
119+
--metrics-port int Prometheus metrics port to use ( default 8080 )
120+
--metrics-path string Path to serve Prometheus metrics on ( default /metrics )
121121
--nodeport-bindon-all-ip For service of NodePort type create IPVS service that listens on all IP's of the node.
122122
--nodes-full-mesh Each node in the cluster will setup BGP peering with rest of the nodes. (default true)
123123
--peer-router-asns uintSlice ASN numbers of the BGP peer to which cluster nodes will advertise cluster ip and node's pod cidr. (default [])
@@ -267,3 +267,6 @@ kubectl annotate service my-service "kube-router.io/service.scheduler=dh"
267267
## BGP configuration
268268

269269
[Configuring BGP Peers](bgp.md)
270+
271+
## Metrics
272+
[Configure metrics gathering](metrics.md)

Documentation/generic.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All pod networking [CIDRs](https://en.wikipedia.org/wiki/Classless_Inter-Domain_
66

77
### Configuring the Kubelet
88

9+
If you choose to run kube-router as daemonset, then both kube-apiserver and kubelet must be run with `--allow-privileged=true` option
10+
911
Ensure each [Kubelet](https://kubernetes.io/docs/reference/generated/kubelet/) is configured with the following options:
1012

1113
--network-plugin=cni
@@ -19,11 +21,13 @@ _**Note: Switching CNI providers on a running cluster requires re-creating all p
1921

2022
### Configuring kube-controller-manager
2123

22-
The following options are mandatory for [kube-controller-manager](https://kubernetes.io/docs/reference/generated/kube-controller-manager/):
24+
If you choose to use kube-router for pod-to-pod network connectivity then [kube-controller-manager](https://kubernetes.io/docs/reference/generated/kube-controller-manager/) need to be configured to allocate pod CIDRs by passing `--allocate-node-cidrs=true` flag and providing a `cluster-cidr` (i.e. by passing --cluster-cidr=10.32.0.0/12 for e.g.)
2325

24-
--cluster-cidr=${POD_NETWORK} # for example 10.32.0.0/12
25-
--service-cluster-ip-range=${SERVICE_IP_RANGE} # for example 10.50.0.0/22
26+
For example:
2627

28+
--allocate-node-cidrs=true
29+
--cluster-cidr=10.32.0.0/12
30+
--service-cluster-ip-range=10.50.0.0/22
2731

2832
## Running kube-router with everything
2933

Documentation/metrics.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Metrics
2+
3+
## Scraping kube-router metrics with Prometheus
4+
5+
The scope of this document is to describe how to setup the [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) needed for [Prometheus](https://prometheus.io/) to use [Kubernetes SD](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<kubernetes_sd_config>) to discover & scape kube-router [pods](https://kubernetes.io/docs/concepts/workloads/pods/pod/).
6+
For help with installing Prometheus please see their [docs](https://prometheus.io/docs/introduction/overview/)
7+
8+
By default kube-router will export Prometheus metrics on port `8080` under the path `/metrics`.
9+
If running kube-router as [daemonset](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/) this port might collide with other applications running on the host network and must be changed.
10+
11+
kube-router 0.1.0-rc2 and upwards supports the following runtime configuration for controlling where to expose the metrics.
12+
If you are using a older version, metrics path & port is locked to `/metrics` & `8080`.
13+
14+
--metrics-port int Prometheus metrics port to use ( default 8080 )
15+
--metrics-path string Path to serve Prometheus metrics on ( default /metrics )
16+
17+
By enabling [Kubernetes SD](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<kubernetes_sd_config>) in Prometheus configuration & adding required annotations it can automaticly discover & scrape kube-router metrics.
18+
19+
## Supported annotations
20+
21+
The following annotations can be set on pods/services to enable automatic SD & scraping
22+
23+
* `prometheus.io/scrape`: Only scrape services that have a value of `true`
24+
* `prometheus.io/path`: If the metrics path is not `/metrics` override this.
25+
* `prometheus.io/port`: If the metrics are exposed on a different port to the
26+
27+
They are to be set under `spec.template.metadata`
28+
29+
For example:
30+
31+
spec:
32+
template:
33+
metadata:
34+
labels:
35+
k8s-app: kube-router
36+
annotations:
37+
prometheus.io/scrape: "true"
38+
prometheus.io/port: "8080"

0 commit comments

Comments
 (0)