You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/11/11 06:10:35 UTC
[skywalking-showcase] branch main updated: Add Kubernetes
monitoring feature
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-showcase.git
The following commit(s) were added to refs/heads/main by this push:
new e5869f4 Add Kubernetes monitoring feature
e5869f4 is described below
commit e5869f41c324cf4611c4fd1af50487f9c0813af0
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Thu Nov 11 14:10:26 2021 +0800
Add Kubernetes monitoring feature
---
.../kubernetes/feature-cluster/resources.yaml | 10 +-
.../feature-kubernetes-monitor/open-telemetry.yaml | 157 +++++++++++++++++++++
.../feature-kubernetes-monitor/permissions.yaml | 53 +++++++
.../kubernetes/feature-single-node/resources.yaml | 10 +-
docs/readme.md | 4 +-
5 files changed, 226 insertions(+), 8 deletions(-)
diff --git a/deploy/platform/kubernetes/feature-cluster/resources.yaml b/deploy/platform/kubernetes/feature-cluster/resources.yaml
index 9706843..d385a41 100644
--- a/deploy/platform/kubernetes/feature-cluster/resources.yaml
+++ b/deploy/platform/kubernetes/feature-cluster/resources.yaml
@@ -72,7 +72,7 @@ data:
<logger name="io.grpc.netty" level="INFO"/>
<logger name="org.apache.skywalking.oap.server.configuration.api" level="TRACE"/>
<logger name="org.apache.skywalking.oap.server.configuration.configmap" level="DEBUG"/>
- <Root level="INFO">
+ <Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
@@ -194,9 +194,13 @@ spec:
- name: SW_HEALTH_CHECKER
value: default
- name: SW_OTEL_RECEIVER
- value: default # @feature: so11y; enable OpenTelemetry receiver to receive OAP metrics
+ value: default # @feature: so11y;vm;kubernetes-monitor enable OpenTelemetry receiver to receive OpenTelemetry metrics
- name: SW_OTEL_RECEIVER_ENABLED_OC_RULES
- value: vm,oap # @feature: so11y; enable oap rules to analyze OAP metrics
+ # @feature: vm; enable vm rules to analyze VM metrics
+ # @feature: so11y; enable oap rules to analyze OAP metrics
+ # @feature: kubernetes-monitor; enable rules to analyze Kubernetes Cluster/Node/Service metrics
+ # @feature: istio-monitor; enable rules to analyze Istio metrics
+ value: vm,oap,k8s-cluster,k8s-node,k8s-service,istio-controlplane
- name: SW_STORAGE
value: elasticsearch
- name: SW_STORAGE_ES_CLUSTER_NODES
diff --git a/deploy/platform/kubernetes/feature-kubernetes-monitor/open-telemetry.yaml b/deploy/platform/kubernetes/feature-kubernetes-monitor/open-telemetry.yaml
new file mode 100644
index 0000000..6c72e56
--- /dev/null
+++ b/deploy/platform/kubernetes/feature-kubernetes-monitor/open-telemetry.yaml
@@ -0,0 +1,157 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# @feature: kubernetes-monitor; set OpenTelemetry config to scrape the Kubernetes metrics
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: otel-collector-conf-kubernetes-monitor
+ labels:
+ app: otel-kubernetes-monitor
+data:
+ otel-collector-config: |
+ service:
+ pipelines:
+ metrics:
+ receivers: [ prometheus ]
+ exporters: [ logging, opencensus ]
+ exporters:
+ opencensus:
+ endpoint: "oap:11800"
+ insecure: true
+ logging:
+ loglevel: debug
+ prometheus:
+ endpoint: "0.0.0.0:9090"
+ receivers:
+ prometheus:
+ config:
+ scrape_configs:
+ # @feature: kubernetes-monitor; configuration to scrape Kubernetes Pods metrics
+ - job_name: kubernetes-pods
+ kubernetes_sd_configs:
+ - role: pod
+ relabel_configs:
+ - source_labels: []
+ target_label: cluster
+ replacement: skywalking-showcase
+ - action: keep
+ regex: true
+ source_labels:
+ - __meta_kubernetes_pod_annotation_prometheus_io_scrape
+ - action: replace
+ regex: (.+)
+ source_labels:
+ - __meta_kubernetes_pod_annotation_prometheus_io_path
+ target_label: __metrics_path__
+ - action: replace
+ regex: ([^:]+)(?::\d+)?;(\d+)
+ replacement: $$1:$$2
+ source_labels:
+ - __address__
+ - __meta_kubernetes_pod_annotation_prometheus_io_port
+ target_label: __address__
+ - action: labelmap
+ regex: __meta_kubernetes_pod_label_(.+)
+ - action: replace
+ source_labels:
+ - __meta_kubernetes_namespace
+ target_label: kubernetes_namespace
+ - action: replace
+ source_labels:
+ - __meta_kubernetes_pod_name
+ target_label: kubernetes_pod_name
+ # @feature: kubernetes-monitor; configuration to scrape Kubernetes Nodes metrics
+ - job_name: 'kubernetes-cadvisor'
+ scheme: https
+ tls_config:
+ ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
+ bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
+ kubernetes_sd_configs:
+ - role: node
+ relabel_configs:
+ - action: labelmap
+ regex: __meta_kubernetes_node_label_(.+)
+ - source_labels: []
+ target_label: cluster
+ replacement: skywalking-showcase
+ - target_label: __address__
+ replacement: kubernetes.default.svc:443
+ - source_labels: [__meta_kubernetes_node_name]
+ regex: (.+)
+ target_label: __metrics_path__
+ replacement: /api/v1/nodes/$${1}/proxy/metrics/cadvisor
+ - source_labels: [instance]
+ separator: ;
+ regex: (.+)
+ target_label: node
+ replacement: $$1
+ action: replace
+ # @feature: kubernetes-monitor; configuration to scrape Kubernetes Endpoints metrics
+ - job_name: kube-state-metrics
+ metrics_path: /metrics
+ kubernetes_sd_configs:
+ - role: endpoints
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_service_label_app_kubernetes_io_name]
+ regex: kube-state-metrics
+ replacement: $$1
+ action: keep
+ - action: labelmap
+ regex: __meta_kubernetes_service_label_(.+)
+ - source_labels: []
+ target_label: cluster
+ replacement: skywalking-showcase
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: otel-deployment-kubernetes-monitor
+ labels:
+ app: otel-kubernetes-monitor
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: otel-kubernetes-monitor
+ template:
+ metadata:
+ labels:
+ app: otel-kubernetes-monitor
+ annotations:
+ sidecar.istio.io/inject: "false"
+ spec:
+ serviceAccountName: otel-sa-kubernetes-monitor
+ containers:
+ - name: otel-kubernetes-monitor
+ image: otel/opentelemetry-collector:0.29.0
+ command:
+ - "/otelcol"
+ - "--config=/conf/otel-collector-config.yaml"
+ volumeMounts:
+ - name: otel-collector-config-vol-kubernetes-monitor
+ mountPath: /conf
+ volumes:
+ - name: otel-collector-config-vol-kubernetes-monitor
+ configMap:
+ name: otel-collector-conf-kubernetes-monitor
+ items:
+ - key: otel-collector-config
+ path: otel-collector-config.yaml
diff --git a/deploy/platform/kubernetes/feature-kubernetes-monitor/permissions.yaml b/deploy/platform/kubernetes/feature-kubernetes-monitor/permissions.yaml
new file mode 100644
index 0000000..80f9e93
--- /dev/null
+++ b/deploy/platform/kubernetes/feature-kubernetes-monitor/permissions.yaml
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: otel-sa-kubernetes-monitor
+
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+ name: otel-role-kubernetes-monitor
+rules:
+ - apiGroups: [ "" ]
+ resources:
+ # @feature: kubernetes-monitor; permissions to read resources
+ - "endpoints"
+ - "pods"
+ - "services"
+ - "nodes"
+ - "nodes/metrics"
+ - "nodes/proxy"
+ verbs: [ "get", "watch", "list" ]
+
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: otel-role-binding-kubernetes-monitor
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: otel-role-kubernetes-monitor
+subjects:
+ - kind: ServiceAccount
+ name: otel-sa-kubernetes-monitor
+ namespace: ${NAMESPACE}
diff --git a/deploy/platform/kubernetes/feature-single-node/resources.yaml b/deploy/platform/kubernetes/feature-single-node/resources.yaml
index 9400f3f..5af8ad0 100644
--- a/deploy/platform/kubernetes/feature-single-node/resources.yaml
+++ b/deploy/platform/kubernetes/feature-single-node/resources.yaml
@@ -72,7 +72,7 @@ data:
<logger name="io.grpc.netty" level="INFO"/>
<logger name="org.apache.skywalking.oap.server.configuration.api" level="TRACE"/>
<logger name="org.apache.skywalking.oap.server.configuration.configmap" level="DEBUG"/>
- <Root level="INFO">
+ <Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
@@ -144,9 +144,13 @@ spec:
- name: SW_HEALTH_CHECKER
value: default
- name: SW_OTEL_RECEIVER
- value: default # @feature: so11y; enable OpenTelemetry receiver to receive OAP metrics
+ value: default # @feature: so11y;vm;kubernetes-monitor enable OpenTelemetry receiver to receive OpenTelemetry metrics
- name: SW_OTEL_RECEIVER_ENABLED_OC_RULES
- value: vm,oap # @feature: so11y; enable oap rules to analyze OAP metrics
+ # @feature: vm; enable vm rules to analyze VM metrics
+ # @feature: so11y; enable oap rules to analyze OAP metrics
+ # @feature: kubernetes-monitor; enable rules to analyze Kubernetes Cluster/Node/Service metrics
+ # @feature: istio-monitor; enable rules to analyze Istio metrics
+ value: vm,oap,k8s-cluster,k8s-node,k8s-service,istio-controlplane
- name: SW_STORAGE
value: elasticsearch
- name: SW_STORAGE_ES_CLUSTER_NODES
diff --git a/docs/readme.md b/docs/readme.md
index b9726b7..567cd7f 100644
--- a/docs/readme.md
+++ b/docs/readme.md
@@ -70,8 +70,8 @@ Currently, the features supported are:
| `single-node` | Deploy only one single node of SkyWalking OAP, and SkyWalking RocketBot UI, ElasticSearch as storage. | Only one of `cluster` or `single-node` can be enabled. |
| `so11y` | Enable SkyWalking self observability. | This is enabled by default for platform [Docker Compose](#docker-compose). |
| `vm` | Start 2 virtual machines and export their metrics to SkyWalking. | The "virtual machines" are mimicked by Docker containers or Pods. |
-| `als` | Start microservices **
-WITHOUT** SkyWalking agent enabled, and configure SkyWalking to analyze the topology and metrics from their access logs. | Command `istioctl` is required to run this feature. The agentless microservices will be running at namespace `${NAMESPACE}-agentless` |
+| `als` | Start microservices **WITHOUT** SkyWalking agent enabled, and configure SkyWalking to analyze the topology and metrics from their access logs. | Command `istioctl` is required to run this feature. The agentless microservices will be running at namespace `${NAMESPACE}-agentless` |
+| `kubernetes-monitor` | Deploy OpenTelemetry and export Kubernetes monitoring metrics to SkyWalking for analysis and display on UI. | |
### Kubernetes