2026年3月20日

nginx配置总结

摘要: 开启debug日志 1. server里面增加error_log /var/log/nginx/debug.log debug;2. location里面增加不存在的测试后端proxy_pass http://172.17.0.3:8080;3. nginx -s reload 访问nginx ip 阅读全文

posted @ 2026-03-20 21:10 王景迁 阅读(1) 评论(0) 推荐(0)

k8s hostport

摘要: spec: containers: - image: nginx name: nginx ports: - containerPort: 80 hostPort: 8080 iptables增加dnat规则,完成主机端口8080到容器端口80的映射。 优点:固定转发到本节点pod。缺点:占用节点端口 阅读全文

posted @ 2026-03-20 20:30 王景迁 阅读(1) 评论(0) 推荐(0)

2026年3月7日

prometheus增加需要采集数据的pod

摘要: Prometheus serviceMonitorSelector ServiceMonitor(描述监控对象信息) matchLabels Service(k8s服务发现) Service+Deploy yaml定义 kind: Service apiVersion: v1 metadata: n 阅读全文

posted @ 2026-03-07 11:15 王景迁 阅读(1) 评论(0) 推荐(0)

2026年3月5日

go实现单机版限流

摘要: go get golang.org/x/time/rate package main import ( "log" "time" "golang.org/x/time/rate" ) func main() { // 创建一个每秒产生5个令牌,桶容量为10的限流器 log.Printf("调整前") 阅读全文

posted @ 2026-03-05 08:02 王景迁 阅读(4) 评论(0) 推荐(0)

平衡kube-apiserver流量

摘要: 问题现象 多个kube-apiserver,重启单个kube-apiserver,会导致请求集中到其他kube-apiserver上,重启的kube-apiserver几乎没有收到请求。 问题分析 重启kube-apiserver,client因连接断开而重连到其他kube-apiserver。cl 阅读全文

posted @ 2026-03-05 07:47 王景迁 阅读(5) 评论(0) 推荐(0)

2026年2月15日

adb命令总结

摘要: # 切root adb root # 通过ip+端口连接主机 adb connect ip:端口 # 进入主机 adb shell # 拷进文件 adb push xxx /root/ # 拷出文件 adb pull xxx ./ 阅读全文

posted @ 2026-02-15 11:01 王景迁 阅读(2) 评论(0) 推荐(0)

2025年12月25日

ping工具总结

摘要: # 指定网口,大写的i -I eth0 # 指定包长 -s 128 # 不分片 -M do 阅读全文

posted @ 2025-12-25 23:07 王景迁 阅读(4) 评论(0) 推荐(0)

2025年12月20日

docker拉取镜像支持http

摘要: docker默认使用https拉取镜像,无法通过http拉取镜像。创建或修改/etc/docker/daemon.json文件,增加insecure-registries字段。 { "insecure-registries" : ["镜像地址域名或者ip:port"] } 重启docker syst 阅读全文

posted @ 2025-12-20 07:03 王景迁 阅读(16) 评论(0) 推荐(0)

2025年12月14日

shell 判断二进制是否可用

摘要: # 结果是yes checkCmd='docker --version' res=`eval $checkCmd 1>/dev/null 2>&1; echo -n $?` resStr=`echo -n $res` if [[ "$resStr" == "0" ]]; then echo "yes 阅读全文

posted @ 2025-12-14 16:38 王景迁 阅读(6) 评论(0) 推荐(0)

shell 容器执行脚本有异常时直接退出

摘要: # pod.yaml # set -e:当脚本中有命令执行返回非0时,脚本会立即终止执行并异常退出。 # set -u:当脚本中引用了未定义的变量时,脚本会立即终止执行并异常退出。 ... containers: - name: busybox image: docker.io/library/bu 阅读全文

posted @ 2025-12-14 15:49 王景迁 阅读(10) 评论(0) 推荐(0)

导航