tao12345666333 commented on code in PR #973:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/973#discussion_r855876740


##########
docs/en/latest/practices/how-to-access-Apache-APISIX-Prometheus-Metrics-on-k8s.md:
##########
@@ -0,0 +1,97 @@
+---
+title: How to access Apache APISIX Prometheus metrics on Kubernetes
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+Observability (monitoring functionality) has always played an essential role 
in system maintenance. A sound monitoring system can help engineers quickly 
understand the status of services running in production environments and locate 
problems or give early warning of anomalies when they occur.
+
+*Prometheus* is a leading open-source project focused on metrics and alerting 
that has changed the way the world does monitoring and observability. APISIX 
has been used with the `public-api` plugin to enhance security in recent 
versions. For more information, see *Prometheus*'s official 
[website](https://prometheus.io/).
+
+## Initial Knowledge about `public-api`
+
+When users develop custom plugins in Apache APISIX, they can define some APIs 
(referred to as public API) for the plugins. The provided interface is for 
internal calls in practical application scenarios rather than being open on the 
public network for anyone to call.
+
+Therefore, Apache APISIX has designed a `public-api` plugin. With this plugin, 
you can solve the public API's pain points. You can set a custom URI for the 
public API and configure any plugin. For more information, see the `public-api` 
Plugin's official 
[document](https://apisix.apache.org/docs/apisix/plugins/public-api/).
+
+The primary role of the `public-api` plugin in this document is to protect the 
URI exposed by *Prometheus*.
+
+**Note**: We should note that this feature is only available in APISIX version 
2.13 and later.
+
+## Begin to access Apache APISIX Prometheus Metrics
+
+Before starting, please make sure that Apache APISIX (version >= 2.13)and 
APISIX Ingress controller are installed and working correctly.
+
+### Step 1: Enable Prometheus Plugin
+
+If you need to monitor Apache APISIX simultaneously, you can create the 
following ApisixClusterConfig resource.
+
+```yaml
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixClusterConfig
+metadata:
+  name: default
+spec:
+  monitoring:
+    prometheus:
+      enable: true
+```
+
+### Step 2: Enable `public-api` Plugin
+
+Let's make a basic routing setup, and please note that further configuration 
should be done based on your local backend service information. The primary 
solution concept is to use the `public-api` plugin to protect the routes 
exposed by *Prometheus*. For a more detailed configuration, you can refer to 
the 
[example](https://apisix.apache.org/zh/docs/apisix/plugins/public-api/#example) 
section of the `public-api` plugin.

Review Comment:
   plz change the link to en instead of zh
   



##########
docs/en/latest/practices/how-to-access-Apache-APISIX-Prometheus-Metrics-on-k8s.md:
##########
@@ -0,0 +1,97 @@
+---
+title: How to access Apache APISIX Prometheus metrics on Kubernetes
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+Observability (monitoring functionality) has always played an essential role 
in system maintenance. A sound monitoring system can help engineers quickly 
understand the status of services running in production environments and locate 
problems or give early warning of anomalies when they occur.
+
+*Prometheus* is a leading open-source project focused on metrics and alerting 
that has changed the way the world does monitoring and observability. APISIX 
has been used with the `public-api` plugin to enhance security in recent 
versions. For more information, see *Prometheus*'s official 
[website](https://prometheus.io/).
+
+## Initial Knowledge about `public-api`
+
+When users develop custom plugins in Apache APISIX, they can define some APIs 
(referred to as public API) for the plugins. The provided interface is for 
internal calls in practical application scenarios rather than being open on the 
public network for anyone to call.
+
+Therefore, Apache APISIX has designed a `public-api` plugin. With this plugin, 
you can solve the public API's pain points. You can set a custom URI for the 
public API and configure any plugin. For more information, see the `public-api` 
Plugin's official 
[document](https://apisix.apache.org/docs/apisix/plugins/public-api/).
+
+The primary role of the `public-api` plugin in this document is to protect the 
URI exposed by *Prometheus*.
+
+**Note**: We should note that this feature is only available in APISIX version 
2.13 and later.
+
+## Begin to access Apache APISIX Prometheus Metrics
+
+Before starting, please make sure that Apache APISIX (version >= 2.13)and 
APISIX Ingress controller are installed and working correctly.
+
+### Step 1: Enable Prometheus Plugin
+
+If you need to monitor Apache APISIX simultaneously, you can create the 
following ApisixClusterConfig resource.
+
+```yaml
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixClusterConfig
+metadata:
+  name: default
+spec:
+  monitoring:
+    prometheus:
+      enable: true
+```
+
+### Step 2: Enable `public-api` Plugin
+
+Let's make a basic routing setup, and please note that further configuration 
should be done based on your local backend service information. The primary 
solution concept is to use the `public-api` plugin to protect the routes 
exposed by *Prometheus*. For a more detailed configuration, you can refer to 
the 
[example](https://apisix.apache.org/zh/docs/apisix/plugins/public-api/#example) 
section of the `public-api` plugin.
+
+```yaml
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+  name: prometheus-route
+spec:
+  http:
+  - name: public-api
+    match:
+      hosts:
+      - test.prometheus.org
+      paths:
+      - /apisix/prometheus/metrics
+    backends:
+    ## Please notice that there must be your actual "serviceName" and 
"servicePort"
+    - serviceName: apisix-test-prometheus

Review Comment:
   You can change it to apisix-admin
   



##########
docs/en/latest/practices/how-to-access-Apache-APISIX-Prometheus-Metrics-on-k8s.md:
##########
@@ -0,0 +1,97 @@
+---
+title: How to access Apache APISIX Prometheus metrics on Kubernetes
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+Observability (monitoring functionality) has always played an essential role 
in system maintenance. A sound monitoring system can help engineers quickly 
understand the status of services running in production environments and locate 
problems or give early warning of anomalies when they occur.
+
+*Prometheus* is a leading open-source project focused on metrics and alerting 
that has changed the way the world does monitoring and observability. APISIX 
has been used with the `public-api` plugin to enhance security in recent 
versions. For more information, see *Prometheus*'s official 
[website](https://prometheus.io/).

Review Comment:
   I think more content should use the link of APISIX public-api plugin.
   
   Or write APISIX use prometheus plgin to expose metrics and integrate with 
prometheus, but use public-api to enhance its security (for details, you can 
look at the description in the prometheus plugin documentation first.



##########
docs/en/latest/practices/how-to-access-Apache-APISIX-Prometheus-Metrics-on-k8s.md:
##########
@@ -0,0 +1,97 @@
+---
+title: How to access Apache APISIX Prometheus metrics on Kubernetes
+---
+
+<!--
+#
+# 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.
+#
+-->
+
+Observability (monitoring functionality) has always played an essential role 
in system maintenance. A sound monitoring system can help engineers quickly 
understand the status of services running in production environments and locate 
problems or give early warning of anomalies when they occur.
+
+*Prometheus* is a leading open-source project focused on metrics and alerting 
that has changed the way the world does monitoring and observability. APISIX 
has been used with the `public-api` plugin to enhance security in recent 
versions. For more information, see *Prometheus*'s official 
[website](https://prometheus.io/).
+
+## Initial Knowledge about `public-api`
+
+When users develop custom plugins in Apache APISIX, they can define some APIs 
(referred to as public API) for the plugins. The provided interface is for 
internal calls in practical application scenarios rather than being open on the 
public network for anyone to call.
+
+Therefore, Apache APISIX has designed a `public-api` plugin. With this plugin, 
you can solve the public API's pain points. You can set a custom URI for the 
public API and configure any plugin. For more information, see the `public-api` 
Plugin's official 
[document](https://apisix.apache.org/docs/apisix/plugins/public-api/).
+
+The primary role of the `public-api` plugin in this document is to protect the 
URI exposed by *Prometheus*.
+
+**Note**: We should note that this feature is only available in APISIX version 
2.13 and later.
+
+## Begin to access Apache APISIX Prometheus Metrics
+
+Before starting, please make sure that Apache APISIX (version >= 2.13)and 
APISIX Ingress controller are installed and working correctly.
+
+### Step 1: Enable Prometheus Plugin
+
+If you need to monitor Apache APISIX simultaneously, you can create the 
following ApisixClusterConfig resource.
+
+```yaml
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixClusterConfig
+metadata:
+  name: default
+spec:
+  monitoring:
+    prometheus:
+      enable: true
+```
+
+### Step 2: Enable `public-api` Plugin
+
+Let's make a basic routing setup, and please note that further configuration 
should be done based on your local backend service information. The primary 
solution concept is to use the `public-api` plugin to protect the routes 
exposed by *Prometheus*. For a more detailed configuration, you can refer to 
the 
[example](https://apisix.apache.org/zh/docs/apisix/plugins/public-api/#example) 
section of the `public-api` plugin.
+
+```yaml
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+  name: prometheus-route
+spec:
+  http:
+  - name: public-api
+    match:
+      hosts:
+      - test.prometheus.org
+      paths:
+      - /apisix/prometheus/metrics
+    backends:
+    ## Please notice that there must be your actual "serviceName" and 
"servicePort"
+    - serviceName: apisix-test-prometheus
+      servicePort: 9180
+    plugins:
+    - name: public-api
+      enable: true
+```
+
+### Step 3: Collect the Metrics
+
+Now you can then get the indicator parameters by requesting command access.
+
+```sh
+kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} 
-- curl http://127.0.0.1:9180/apisix/admin/routes -H 'X-API-Key: 
edd1c9f034335f136f87ad84b625c8f1'
+
+kubectl exec -it -n ${namespace of Apache APISIX} ${Pod name of Apache APISIX} 
-- curl http://127.0.0.1:9080/headers -H 'Host: test.prometheus.org'

Review Comment:
   You can show the output contents. 
   
   This way we know what the expected result should be



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to