当前位置:网站首页>How the query address of cloud native monitoring data exposes the public network
How the query address of cloud native monitoring data exposes the public network
2022-06-24 04:55:00 【Nieweixing】
prometheus Now it's mainstream monitoring k8s programme , All major cloud vendors also have managed k8s service , In order to better manage k8s Cluster monitoring , Also launched managed prometheus Monitoring service , Tencent cloud launched the Tencent cloud native monitoring service (Tencent Prometheus Service,TPS) Hereinafter referred to as TPS,TPS
One click deployment prometheus To the back-end elastic cluster , Then you can monitor your tke Cluster to monitor .
Tencent cloud's TPS The service backend uses thanos framework , In order to make it easier to query monitoring indicators , Provides thanos query The front page address is used to query the monitoring data , But this address only provides intranet access , A lot of times , We are pc The client cannot be accessed directly vpc The intranet address of , It is very inconvenient to query data , Now let's talk about how to expose TPS Data query address to the public network .
Actually, the plan is very simple , It's with TPS Same as vpc Under the tke Deploy one in the cluster nginx The reverse proxy appears , And then to nginx To configure a nodeport Or on the public network clb Type of service that will do , The specific configuration steps are as follows .
1. Query the cloud native monitoring instance data query address
The data query address of cloud native monitoring , You can query on the basic information page of the instance ,Prometheus The data query address is thanos query The address of
2. establish nginx Forwarding profile
Create a configmap To configure default.conf Files are used to forward TPS Of thanos query Search address , Be careful proxy_pass Fill in your actual intranet query address later , Next, mount this configmap To pod Just inside
apiVersion: v1
data:
default.conf: |-
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
proxy_pass http://10.0.0.234:9090/;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 1000m;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
kind: ConfigMap
metadata:
name: nginx-cm
namespace: monitor3. establish nginx Of workload
Create a nginx Workload for , Then mount the configuration in the previous step to the container default.conf file .
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: tps-thanos-nginx
qcloud-app: tps-thanos-nginx
name: tps-thanos-nginx
namespace: monitor
spec:
replicas: 1
selector:
matchLabels:
k8s-app: tps-thanos-nginx
qcloud-app: tps-thanos-nginx
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
k8s-app: tps-thanos-nginx
qcloud-app: tps-thanos-nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: tps-thanos-nginx
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 250m
memory: 256Mi
securityContext:
privileged: false
volumeMounts:
- mountPath: /etc/nginx/conf.d/default.conf
name: vol
subPath: default.conf
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 420
name: nginx-cm
name: vol4. Generate service binding workload
establish servic Bound to the backend workload, If you don't want to spend money on the Internet clb, It can be used nodeport Type of svc, Through the public network of nodes ip and nodeport visit .
apiVersion: v1
kind: Service
metadata:
name: tps-thanos-nginx
namespace: monitor
spec:
externalTrafficPolicy: Cluster
ports:
- name: 80-80-tcp
nodePort: 31642
port: 80
protocol: TCP
targetPort: 80
selector:
k8s-app: tps-thanos-nginx
qcloud-app: tps-thanos-nginx
sessionAffinity: None
type: LoadBalancer5. ingress Expose the domain name to provide access
If the cluster is deployed nginx-ingress, It can also be used. nginx-ingress To expose a domain name to access , You can also use it tke The type of load balancing provided ingress Expose the domain name to provide access .
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: ingress
name: tps-thanos-ingress
namespace: monitor
spec:
rules:
- host: tps-thanos.tke.niewx.cn
http:
paths:
- backend:
serviceName: tps-thanos-nginx
servicePort: 80
path: /6. Public network access query address
Browser input public network clb Of vip visit TPS Of prometheus Data query address
Browser input node public network ip and nodeport visit TPS Of prometheus Data query address
Browser domain name access TPS Of prometheus Data query address
Then we can go through the browser ui Page to query prometheus We've got a lot of monitoring data .
边栏推荐
- Abnova membrane protein lipoprotein solution
- Many regulations come into effect today! The main responsibility of network security will be further implemented
- 胶原蛋白酶——Worthington四种类型的粗胶原酶
- Detailed explanation of tcpip protocol
- How to operate ECs and what types of system configuration schemes can be supported
- What does VPS server mean? What is the difference between a VPS server and an ECS?
- How to build a website for ECS? What are the prices of different ECS
- Find the current index of gbase 8C database?
- Advantages of fixed assets management system
- Analyze the actual user groups and demand positioning of distributed database products from the market and demand
猜你喜欢

Introduction à la méthode de descente par Gradient - document d'apprentissage automatique pour les programmeurs de chevaux noirs

Facebook internal announcement: instant messaging will be re integrated

Abnova peptide design and synthesis solutions

Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole

"Emergency response practice" logparser log analysis practice

An interface testing software that supports offline document sharing in the Intranet

Abnova membrane protein lipoprotein solution

阿里云混合云首席架构师张晓丹:政企混合云技术架构的演进和发展

Abnova多肽设计和合成解决方案

什么是数据中台
随机推荐
SAP mts/ato/mto/eto topic 8: ATO mode 2 d+ empty mode strategy 85
How to enlarge the ECS page? How to select ECS instance specifications?
What are the differences between ECs and virtual hosts? Which is better, ECS or VM?
Black horse programmer machine learning handout: preliminary use of linear regression API
Analyzing the superiority of humanoid robot in the post human era
What are the advantages of ECS? Is ECS better than VM?
Jimureport building block report - what problems does the layout design solve?
Problem: SQL create stored procedure
Popularization of children's programming education in specific scenarios
SAP mts/ato/mto/eto topic 7: ATO mode 1 m+m mode strategy 82 (6892)
Brief introduction: how much do you know about supply chain attacks
TCPIP协议详解
梯度下降法介绍-黑马程序员机器学习讲义
Abnova fluorescence in situ hybridization (FISH) probe solution
Develop a customized music player from scratch, and your girlfriend will have it?
Loss and optimization of linear regression, machine learning to predict house prices
Powerbi - for you who are learning
Introduction to the "penetration foundation" cobalt strike Foundation_ Cobalt strike linkage msfconsole
Introduction to C language custom types (structure, enumeration, union, bit segment)
Spirit breath development log (15)