enable prometheus metrics in felix
Calico Felix can listen on port 9091 (configurable) and export
prometheus metrics here.
Change-Id: I927d9ee952c4b1aacae80c7e0f9b6adbf90e8a9c
diff --git a/README.rst b/README.rst
index 98785ed..16f967b 100644
--- a/README.rst
+++ b/README.rst
@@ -193,8 +193,6 @@
kubelet: 7bN5hJ9JD4fKjnFTkUKsvVNfuyEddw3r
version: v1.2.4
-
-
Kubernetes with OpenContrail network plugin
------------------------------------------------
@@ -354,6 +352,20 @@
ssl:
enabled: true
+Enable Prometheus metrics in Felix
+
+.. code-block:: yaml
+
+ kubernetes:
+ pool:
+ network:
+ prometheus:
+ enabled: true
+ master:
+ network:
+ prometheus:
+ enabled: true
+
Post deployment configuration
.. code-block:: bash
diff --git a/kubernetes/files/calico/calico-node.service.master b/kubernetes/files/calico/calico-node.service.master
index afa34c5..924364d 100644
--- a/kubernetes/files/calico/calico-node.service.master
+++ b/kubernetes/files/calico/calico-node.service.master
@@ -11,28 +11,32 @@
-e HOSTNAME={{ master.host.name }} \
-e IP={{ master.apiserver.address }} \
-e IP6={{ master.get('ipv6_address', '') }} \
- {%- if master.network.calico_network_backend is defined %}
+{%- if master.network.calico_network_backend is defined %}
-e CALICO_NETWORKING_BACKEND="{{ master.network.calico_network_backend }}"
- {%- endif %}
+{%- endif %}
-e AS={{ master.network.get('as', '64512') }} \
-e NO_DEFAULT_MASTERS={{ master.network.get('no_default_masters') }} \
-e CALICO_LIBNETWORK_ENABLED={{ master.network.get('libnetwork_enabled', true ) }} \
-e ETCD_ENDPOINTS={% for member in master.network.etcd.members %}http{% if master.network.etcd.get('ssl', {}).get('enabled') %}s{% endif %}://{{ member.host }}:{{ member.port }}{% if not loop.last %},{% endif %}{% endfor %} \
- {%- if master.network.etcd.get('ssl', {}).get('enabled') %}
+{%- if master.network.etcd.get('ssl', {}).get('enabled') %}
-e ETCD_CA_CERT_FILE=/var/lib/etcd/ca.pem \
-e ETCD_CERT_FILE=/var/lib/etcd/etcd-client.crt \
-e ETCD_KEY_FILE=/var/lib/etcd/etcd-client.key \
-v /var/lib/etcd/:/var/lib/etcd/:ro \
- {%- endif %}
+{%- endif %}
+{%- if master.network.get('prometheus', {}).get('enabled') %}
+ -e FELIX_PROMETHEUSMETRICSENABLED=true \
+ -p {{ pool.network.prometheus.get('address', '0.0.0.0') }}:{{ master.network.get('prometheus', {}).get('port', 9091) }}:9091 \
+{%- endif %}
-v /var/log/calico:/var/log/calico \
-v /run/docker/plugins:/run/docker/plugins \
-v /lib/modules:/lib/modules \
-v /var/run/calico:/var/run/calico \
- {%- if master.network.volumes is defined %}
- {%- for volume in master.network.volumes %}
+{%- if master.network.volumes is defined %}
+{%- for volume in master.network.volumes %}
-v {{ volume }} \
- {%- endfor %}
- {%- endif %}
+{%- endfor %}
+{%- endif %}
{{ master.network.get('image', 'calico/node') }}
Restart=always
diff --git a/kubernetes/files/calico/calico-node.service.pool b/kubernetes/files/calico/calico-node.service.pool
index eed75d0..dbc60e1 100644
--- a/kubernetes/files/calico/calico-node.service.pool
+++ b/kubernetes/files/calico/calico-node.service.pool
@@ -11,28 +11,33 @@
-e HOSTNAME={{ pool.host.name }} \
-e IP={{ pool.address }} \
-e IP6={{ pool.get('ipv6_address', '') }} \
- {%- if pool.network.calico_network_backend is defined %}
+{%- if pool.network.calico_network_backend is defined %}
-e CALICO_NETWORKING_BACKEND="{{ pool.network.calico_network_backend }}"
- {%- endif %}
+{%- endif %}
-e AS={{ pool.network.get('as', '64512') }} \
-e NO_DEFAULT_POOLS={{ pool.network.get('no_default_pools') }} \
-e CALICO_LIBNETWORK_ENABLED={{ pool.network.get('libnetwork_enabled', true ) }} \
-e ETCD_ENDPOINTS={% for member in pool.network.etcd.members %}http{% if pool.network.etcd.get('ssl', {}).get('enabled') %}s{% endif %}://{{ member.host }}:{{ member.port }}{% if not loop.last %},{% endif %}{% endfor %} \
- {%- if pool.network.etcd.get('ssl', {}).get('enabled') %}
+{%- if pool.network.etcd.get('ssl', {}).get('enabled') %}
-e ETCD_CA_CERT_FILE=/var/lib/etcd/ca.pem \
-e ETCD_CERT_FILE=/var/lib/etcd/etcd-client.crt \
-e ETCD_KEY_FILE=/var/lib/etcd/etcd-client.key \
-v /var/lib/etcd/:/var/lib/etcd/:ro \
- {%- endif %}
+{%- endif %}
+{%- if pool.network.get('prometheus', {}).get('enabled') %}
+ -e FELIX_PROMETHEUSMETRICSENABLED=true \
+ -e FELIX_PROMETHEUSMETRICSPORT={{ pool.network.prometheus.get('port', 9091) }} \
+ -p {{ pool.network.prometheus.get('address', '0.0.0.0') }}:{{ pool.network.prometheus.get('port', 9091) }}:9091 \
+{%- endif %}
-v /var/log/calico:/var/log/calico \
-v /run/docker/plugins:/run/docker/plugins \
-v /lib/modules:/lib/modules \
-v /var/run/calico:/var/run/calico \
- {%- if pool.network.volumes is defined %}
- {%- for volume in pool.network.volumes %}
+{%- if pool.network.volumes is defined %}
+{%- for volume in pool.network.volumes %}
-v {{ volume }} \
- {%- endfor %}
- {%- endif %}
+{%- endfor %}
+{%- endif %}
{{ pool.network.get('image', 'calico/node') }}
Restart=always