Skip to content

Commit 15531ba

Browse files
Diogo GuerraGregWhiteyBialas
authored andcommitted
Update magnum k8s monitoring infra
* Prometheus-server now runs only on master nodes. * Update prometheus-operator helm chart and tag. * Update prometheus-adapter version. * Deprecation notice for prometheus_monitoring component. Since v1.20 (changes are gradually introduced in next versions) k8s components are exposing (by default) metrics on 127.0.0.1 and are changing expose port. * Fix metrics address and ports post 1.20 * Extended memory limits to 64M * Changed expose addr to 127.0.0.1 * Changed expose ports task: 41569 story: 2006765 Signed-off-by: Diogo Guerra <[email protected]> Co-authored-by: Grzegorz Bialas <[email protected]> Change-Id: I05e8c2be4e4c8e66a166b485ec7851875dca8b1c (cherry picked from commit c92f605) (cherry picked from commit 32b22e5) (cherry picked from commit 5b56182) (cherry picked from commit 25e3bdc) (cherry picked from commit d0e1aa2) (cherry picked from commit 903f7f6)
1 parent 8b76a90 commit 15531ba

File tree

3 files changed

+24
-29
lines changed

3 files changed

+24
-29
lines changed

magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ CERT_DIR=/etc/kubernetes/certs
271271

272272
# kube-proxy config
273273
PROXY_KUBECONFIG=/etc/kubernetes/proxy-kubeconfig.yaml
274-
KUBE_PROXY_ARGS="--kubeconfig=${PROXY_KUBECONFIG} --cluster-cidr=${PODS_NETWORK_CIDR} --hostname-override=${INSTANCE_NAME}"
274+
KUBE_PROXY_ARGS="--kubeconfig=${PROXY_KUBECONFIG} --cluster-cidr=${PODS_NETWORK_CIDR} --hostname-override=${INSTANCE_NAME} --metrics-bind-address=0.0.0.0"
275275
cat > /etc/kubernetes/proxy << EOF
276276
KUBE_PROXY_ARGS="${KUBE_PROXY_ARGS} ${KUBEPROXY_OPTIONS}"
277277
EOF
@@ -406,6 +406,8 @@ KUBE_CONTROLLER_MANAGER_ARGS="--leader-elect=true --kubeconfig=/etc/kubernetes/a
406406
KUBE_CONTROLLER_MANAGER_ARGS="$KUBE_CONTROLLER_MANAGER_ARGS --cluster-name=${CLUSTER_UUID}"
407407
KUBE_CONTROLLER_MANAGER_ARGS="${KUBE_CONTROLLER_MANAGER_ARGS} --allocate-node-cidrs=true"
408408
KUBE_CONTROLLER_MANAGER_ARGS="${KUBE_CONTROLLER_MANAGER_ARGS} --cluster-cidr=${PODS_NETWORK_CIDR}"
409+
KUBE_CONTROLLER_MANAGER_ARGS="${KUBE_CONTROLLER_MANAGER_ARGS} --secure-port=10257"
410+
KUBE_CONTROLLER_MANAGER_ARGS="${KUBE_CONTROLLER_MANAGER_ARGS} --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics"
409411
KUBE_CONTROLLER_MANAGER_ARGS="$KUBE_CONTROLLER_MANAGER_ARGS $KUBECONTROLLER_OPTIONS"
410412
if [ -n "${ADMISSION_CONTROL_LIST}" ] && [ "${TLS_DISABLED}" == "False" ]; then
411413
KUBE_CONTROLLER_MANAGER_ARGS="$KUBE_CONTROLLER_MANAGER_ARGS --service-account-private-key-file=$CERT_DIR/service_account_private.key --root-ca-file=$CERT_DIR/ca.crt"
@@ -428,7 +430,7 @@ sed -i '
428430
/^KUBE_CONTROLLER_MANAGER_ARGS=/ s#\(KUBE_CONTROLLER_MANAGER_ARGS\).*#\1="'"${KUBE_CONTROLLER_MANAGER_ARGS}"'"#
429431
' /etc/kubernetes/controller-manager
430432

431-
sed -i '/^KUBE_SCHEDULER_ARGS=/ s#=.*#="--leader-elect=true --kubeconfig=/etc/kubernetes/admin.conf"#' /etc/kubernetes/scheduler
433+
sed -i '/^KUBE_SCHEDULER_ARGS=/ s#=.*#="--leader-elect=true --kubeconfig=/etc/kubernetes/admin.conf --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics "#' /etc/kubernetes/scheduler
432434

433435
$ssh_cmd mkdir -p /etc/kubernetes/manifests
434436
KUBELET_ARGS="--register-node=true --pod-manifest-path=/etc/kubernetes/manifests --hostname-override=${INSTANCE_NAME}"

magnum/drivers/common/templates/kubernetes/helm/prometheus-operator.sh

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,10 @@ ${APP_INGRESS_ANNOTATIONS}
180180
endpoints: ${KUBE_MASTERS_PRIVATE}
181181
## If using kubeControllerManager.endpoints only the port and targetPort are used
182182
service:
183-
port: 10252
184-
targetPort: 10252
183+
port: 10257
184+
targetPort: 10257
185185
# selector:
186186
# component: kube-controller-manager
187-
serviceMonitor:
188-
## Enable scraping kube-controller-manager over https.
189-
## Requires proper certs (not self-signed) and delegated authentication/authorization checks
190-
https: "True"
191-
# Skip TLS certificate validation when scraping
192-
insecureSkipVerify: "True"
193-
# Name of the server to use when validating TLS certificate
194-
serverName: null
195187
196188
coreDns:
197189
enabled: true
@@ -224,28 +216,17 @@ ${APP_INGRESS_ANNOTATIONS}
224216
endpoints: ${KUBE_MASTERS_PRIVATE}
225217
## If using kubeScheduler.endpoints only the port and targetPort are used
226218
service:
227-
port: 10251
228-
targetPort: 10251
219+
port: 10259
220+
targetPort: 10259
229221
# selector:
230222
# component: kube-scheduler
231223
serviceMonitor:
232-
## Enable scraping kube-scheduler over https.
233-
## Requires proper certs (not self-signed) and delegated authentication/authorization checks
234-
https: "True"
235-
## Skip TLS certificate validation when scraping
236-
insecureSkipVerify: "True"
237-
## Name of the server to use when validating TLS certificate
238-
serverName: null
224+
scheme: https
225+
insecureSkipVerify: true
239226
240227
kubeProxy:
241228
## If your kube proxy is not deployed as a pod, specify IPs it can be found on
242229
endpoints: ${KUBE_MASTERS_PRIVATE} # masters + minions
243-
serviceMonitor:
244-
## Enable scraping kube-proxy over https.
245-
## Requires proper certs (not self-signed) and delegated authentication/authorization checks
246-
https: "True"
247-
## Skip TLS certificate validation when scraping
248-
insecureSkipVerify: "True"
249230
250231
kube-state-metrics:
251232
priorityClassName: "system-cluster-critical"
@@ -272,7 +253,7 @@ ${APP_INGRESS_ANNOTATIONS}
272253
requests:
273254
cpu: 2m
274255
limits:
275-
memory: 30M
256+
memory: 64M
276257
# clusterDomain: ${CLUSTER_ROOT_DOMAIN_NAME}
277258
priorityClassName: "system-cluster-critical"
278259
logFormat: json
@@ -281,7 +262,7 @@ ${APP_INGRESS_ANNOTATIONS}
281262
requests:
282263
cpu: 2m
283264
limits:
284-
memory: 32M
265+
memory: 64M
285266
image:
286267
repository: ${CONTAINER_INFRA_PREFIX:-quay.io/prometheus-operator/}prometheus-operator
287268
prometheusDefaultBaseImage: ${CONTAINER_INFRA_PREFIX:-quay.io/prometheus/}prometheus

magnum/drivers/k8s_fedora_coreos_v1/templates/kubecluster.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,18 @@ resources:
11161116
- protocol: tcp
11171117
port_range_min: 9090
11181118
port_range_max: 9090
1119+
- protocol: tcp
1120+
port_range_min: 10259
1121+
port_range_max: 10259
1122+
- protocol: tcp
1123+
port_range_min: 10257
1124+
port_range_max: 10257
1125+
- protocol: tcp
1126+
port_range_min: 10249
1127+
port_range_max: 10249
1128+
- protocol: tcp
1129+
port_range_min: 9153
1130+
port_range_max: 9153
11191131

11201132
secgroup_kube_minion:
11211133
condition: create_cluster_resources

0 commit comments

Comments
 (0)