您可以通过开启 Ingress 默认 VTS 模块来查看 Ingress 监控数据。
通过命令行操作
1. 修改 Ingress ConfigMap 配置,增加配置项 enable-vts-status: "true"。
root@master # kubectl edit configmap nginx-configuration -n kube-system
configmap "nginx-configuration" edited
修改后 Ingress ConfigMap 内容如下:
apiVersion: v1
2. 验证 Ingress Nginx 正常开启 VTS 模块。
data:
enable-vts-status: "true" # 开启VTS模块
proxy-body-size: 20m
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"proxy-body-size":"20m"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app":"ingress-nginx"},"name":"nginx-configuration","namespace":"kube-system"}}
creationTimestamp: 2018-03-20T07:10:18Z
labels:
app: ingress-nginx
name: nginx-configuration
namespace: kube-system
selfLink: /api/v1/namespaces/kube-system/configmaps/nginx-configuration
root@master # kubectl get pods --selector=app=ingress-nginx -n kube-system
NAME READY STATUS RESTARTS AGE
nginx-ingress-controller-79877595c8-78gq8 1/1 Running 0 1h
root@master # kubectl exec -it nginx-ingress-controller-79877595c8-78gq8 -n kube-system -- cat /etc/nginx/nginx.conf | grep vhost_traffic_status_display
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
3. 本地访问 Ingress Nginx 监控控制台。
root@master # kubectl port-forward nginx-ingress-controller-79877595c8-78gq8 -n kube-system 18080
4. 通过
http://localhost:18080/nginx_status 来访问 VTS 监控控制台。
Forwarding from 127.0.0.1:18080 -> 18080
Handling connection for 18080
通过 Kubernetes Dashboard 操作
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "nginx-configuration",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/configmaps/nginx-configuration",
"creationTimestamp": "2018-03-20T07:10:18Z",
"labels": {
"app": "ingress-nginx"
},
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"data\":{\"proxy-body-size\":\"20m\"},\"kind\":\"ConfigMap\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"ingress-nginx\"},\"name\":\"nginx-configuration\",\"namespace\":\"kube-system\"}}\n"
}
},
"data": {
"proxy-body-size": "20m",
"enable-vts-status": "true"
}
}
4. 本地访问 Ingress Nginx 监控控制台。
root@master # kubectl port-forward nginx-ingress-controller-79877595c8-78gq8 -n kube-system 18080
Forwarding from 127.0.0.1:18080 -> 18080
Handling connection for 18080
5. 通过
http://localhost:18080/nginx_status 来访问 VTS 监控控制台。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。