Skip to content
Snippets Groups Projects
Commit b59b2c23 authored by Damien Grisonnet's avatar Damien Grisonnet
Browse files

examples: update platform snippets and doc

parent f06175bb
No related branches found
No related tags found
No related merge requests found
......@@ -360,57 +360,28 @@ Jsonnet is a turing complete language, any logic can be reflected in it. It also
### Cluster Creation Tools
A common example is that not all Kubernetes clusters are created exactly the same way, meaning the configuration to monitor them may be slightly different. For [kubeadm](examples/jsonnet-snippets/kubeadm.jsonnet), [bootkube](examples/jsonnet-snippets/bootkube.jsonnet), [kops](examples/jsonnet-snippets/kops.jsonnet) and [kubespray](examples/jsonnet-snippets/kubespray.jsonnet) clusters there are mixins available to easily configure these:
A common example is that not all Kubernetes clusters are created exactly the same way, meaning the configuration to monitor them may be slightly different. For the following clusters there are mixins available to easily configure them:
kubeadm:
* aws
* bootkube
* eks
* gke
* kops-coredns
* kubeadm
* kubespray
[embedmd]:# (examples/jsonnet-snippets/kubeadm.jsonnet)
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kubeadm.libsonnet')
```
bootkube:
[embedmd]:# (examples/jsonnet-snippets/bootkube.jsonnet)
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/bootkube.libsonnet')
```
kops:
[embedmd]:# (examples/jsonnet-snippets/kops.jsonnet)
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kops.libsonnet')
```
kops with CoreDNS:
If your kops cluster is using CoreDNS, there is an additional mixin to import.
These mixins are selectable via the `platform` field of kubePrometheus:
[embedmd]:# (examples/jsonnet-snippets/kops-coredns.jsonnet)
[embedmd]:# (examples/jsonnet-snippets/platform.jsonnet)
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kops.libsonnet') +
(import 'kube-prometheus/platforms/kops-coredns.libsonnet')
```
kubespray:
[embedmd]:# (examples/jsonnet-snippets/kubespray.jsonnet)
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kubespray.libsonnet')
```
aws:
[embedmd]:# (examples/jsonnet-snippets/aws.jsonnet)
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/aws.libsonnet')
{
values+:: {
kubePrometheus+: {
platform: 'example-platform',
},
},
}
```
### Internal Registry
......
......@@ -7,12 +7,14 @@ One fatal issue that can occur is that you run out of IP addresses in your eks c
You can monitor the `awscni` using kube-promethus with :
[embedmd]:# (../examples/eks-cni-example.jsonnet)
```jsonnet
local kp = (import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/eks.libsonnet') + {
local kp = (import 'kube-prometheus/main.libsonnet') + {
values+:: {
common+: {
namespace: 'monitoring',
},
kubePrometheus+: {
platform: 'eks',
},
},
kubernetesControlPlane+: {
prometheusRuleEksCNI+: {
......
local kp = (import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/eks.libsonnet') + {
local kp = (import 'kube-prometheus/main.libsonnet') + {
values+:: {
common+: {
namespace: 'monitoring',
},
kubePrometheus+: {
platform: 'eks',
},
},
kubernetesControlPlane+: {
prometheusRuleEksCNI+: {
......
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/bootkube.libsonnet')
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kops.libsonnet') +
(import 'kube-prometheus/platforms/kops-coredns.libsonnet')
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kops.libsonnet')
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kubeadm.libsonnet')
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kubespray.libsonnet')
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/aws.libsonnet')
{
values+:: {
kubePrometheus+: {
platform: 'example-platform',
},
},
}
local kp =
(import 'kube-prometheus/main.libsonnet') +
(import 'kube-prometheus/platforms/kubeadm.libsonnet') +
// Note that NodePort type services is likely not a good idea for your production use case, it is only used for demonstration purposes here.
(import 'kube-prometheus/addons/node-ports.libsonnet') +
{
......@@ -19,6 +18,9 @@ local kp =
},
},
},
kubePrometheus+: {
platform: 'kubeadm',
},
},
// For simplicity, each of the following values for 'externalUrl':
......
# Adding a new platform specific configuration
Adding a new platform specific configuration requires to update the
[platforms.jsonnet](./platform.jsonnet) file by adding the platform to the list
of existing ones.
This allow configuring the new platform in the following way:
```jsonnet
(import 'kube-prometheus/main.libsonnet') +
{
values+:: {
kubePrometheus+: {
platform: 'example-platform',
}
}
}
```
Adding a new platform specific configuration requires to update the [README](../../../README.md#cluster-creation-tools) and the [platforms.jsonnet](./platform.jsonnet) file by adding the platform to the list of existing ones. This allow the new platform to be discoverable and easily configurable by the users.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment