• 首页
    • kubernetes
    • rust
    • nginx
    • Prometheus
  • 禅
  • 关于
  1. 我在这里:  
  2. 首页

kubernetes 1.27+ 容忍污点配置

菜单项设置
作者: admin
分类:kubernetes
日期:2025年12月16日
点击数: 22
  • kubernetes
  • k8s

前期准备工作:(默认kubernetes集群已经存在)

给k8s-node1打上标签disktype=ssd

kubectl  label  nodes  k8s-node1  disktype=ssd

给k8s-node1打上污点

kubectl  taint  nodes  k8s-node1  tt=ok:NoSchedule      #表示打上tt=ok污点并且不要进行分配调度

1、节点匹配:表示匹配到节点但是由于该节点有污点到则分配到其它节点

spec:
  nodeSelector:
    disktype:  ssd          #disktype=ssd  是k8s-node1上打的标签

2、容忍污点配置:表示匹配的节点配置了污点配置也可以分配

spec:
  tolerations:
  - key: tt
    operator:
    value: ok
    effect: NoSchedule
  nodeSelector:
    disktype: ssd

3、无视污点配置:

spec:
  nodeName: k8s-node1   #配置了nodeName的节点即使有污点也可以无视,照样进行分配
  nodeSelector: 
    disktype: ssd

4、容忍污点配置:匹配任意污点,可以在该节点进行分配

spec:
  tolerations:
  - effect: NoSchedule
    operator: Exists

删除k8s-node1上的标签disktype=ssd

kubectl  label  nodes  k8s-node1  disktype-

删除k8s-node1上的污点tt=ok

kubectl  taint  nodes  k8s-node1  tt-

rust安装

菜单项设置
作者: admin
分类:rust
日期:2025年12月16日
点击数: 53
  • rust

rust安装步骤

rust官方网站:https://www.rust-lang.org/

1、安装命令:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

然后默认回车就可以了

2、查看是否安装成功

~$  rustc -V

rustc 1.92.0 (ded5c06cf 2025-12-08) 

~$ 

nginx反向代理grafana的子路径问题处理

菜单项设置
作者: admin
分类:nginx
日期:2025年12月16日
点击数: 60
  • nginx
  • grafana

nginx反向代理grafana的时需要注意的地方:

1、一种是正常的反向代理即直接是子域名的方式,如 grafana.youdomain.com,访问此地址会根据nginx配置中后端grafana地址返回服务端的数据给客户端。

2、一种是只有一个主域名,通过子路径的方式来访问grafana数据。nginx除了要配置grafana后端地址外,同时grafana的配置文件( grafana.ini )还要配置root_url和serve_from_sub_path。

子路径(Subpath)配置问题:

如果你将Grafana部署在子路径下(例如http://yourdomain.com/grafana),你需要在Grafana的配置文件(grafana.ini)中设置root_url为包含子路径的URL。例如,root_url = http://yourdomain.com/grafana。
如果你没有使用反向代理,但想要Grafana从子路径提供服务,可以在Grafana的启动参数中设置serve_from_sub_path = true(注意:这个设置可能因Grafana版本而异,某些版本可能通过环境变量GF_SERVER_SERVE_FROM_SUB_PATH来设置)。

最后记得重启nginx、grafana服务使其生效。

nginx配置子路径访问prometheus

菜单项设置
作者: admin
分类:nginx
日期:2025年12月16日
点击数: 56
  • nginx
  • Prometheus

在仅有一个主域名的情况下通过子路径访问prometheus,在nginx中的配置如下:

upstream prometheus {
       server   127.0.0.1:9090 ;
}

server  {

....

    #配置prometheus的跳转地址
    location /prometheus/ {
    #proxy_pass 末尾加上 / ,否则报错404
    proxy_pass http://prometheus/ ;
    #直接配置prometheus端口地址也可以,末尾加上 / ,否则报错404
    #proxy_pass http://localhost:9090/ ;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header X-Forwarded-Proto $scheme;
    #301重定向
    # return 301 https://$host$request_uri;
    #是否重定向重写后端服务器返给客户端的URL地址,off 禁用重定向重写
    #proxy_redirect off ;
    }

.....

}

Prometheus安装

菜单项设置
作者: admin
分类:Prometheus
日期:2025年12月16日
点击数: 30
  • Prometheus

prometheus官网: https://prometheus.io/

安装地址:https://prometheus.io/docs/prometheus/latest/getting_started/

1、下载prometheus的安装包

下载地址: https://prometheus.io/download

下载合适的版本

wget  https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz

2、解压

tar xvfz prometheus-*.tar.gz
cd prometheus-*

3、启动之前修改一下prometheus的配置文件prometheus.yaml


global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

 

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
      - targets: ['localhost:9090']

4、启动prometheus

# Start Prometheus.
# By default, Prometheus stores its database in ./data (flag --storage.tsdb.path).
./prometheus --config.file=prometheus.yml

5、在浏览器中输入: http://localhost:9090/metrics ,可以查看当前的采集指标
http://localhost:9090/graph 可以查看图形化的一些数据

6、接下来就可以下载相应的exporter工具用于prometheus采集非原生的数据,比如node_exproter(采集服务器的系统指标)

Login Form

  • 找回密码
  • 找回用户名

Copyright © 2026 生活禅. 版权所有   公安备案号:1110502048781  ICP备案:渝ICP备16005388号-2

Joomla! 是遵循 GNU 通用公共许可(General Public License)协议发布的自由软件(Free Software)