学习
在服务器上使用 Gemini CLI
· ☕ 3 分钟
1. 获取项目 ID 和 API 密钥 访问 https://aistudio.google.com/apikey 获取项目 ID 和 API 密钥,并设置为环境变量 1 2 echo "export GOOGLE_CLOUD_PROJECT=" >> ~/.bashrc echo "export GEMINI_API_KEY=" >> ~/.bashrc 1 source ~/.bashrc 2. 准备 node.js 环境 安装 nvm 1 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash 1 2 echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bashrc 1 source ~/.bashrc 查看 nvm 版本 1 nvm --version 安装 node.js 1 nvm install 20 升级 npm 1 npm install -g npm 3. 安装 gemini 1

给 Node Exporter 添加抓取凭证
· ☕ 1 分钟
1. 背景 Node Exporter 是 Prometheus 生态系统中用于收集主机指标的常用组件,但默认情况下不提供访问认证。本文介绍如何为 Kubernetes 环境中的 Node Exporter 添加基本认证,提高安全性。 2. Node Exporter 配置凭证 2.1 生成加密密码 使用 htpasswd 工具生成加密密码: 1 htpasswd -nBC 12 "" | tr -d ':\n' 这里需要输入密码,生成的输出将是一个

部署 smokeping-prober 探测网络质量
· ☕ 1 分钟
1. smokeping-prober 是什么 smokeping-prober 是一个用于探测网络质量的工具,它通过向目标节点发送 ICMP 请求来探测网络质量。 2. 部署 smokeping-prober 2.1 生成 smokeping-prober.yaml 配置文件 1 2 3 4 5 6 7 8 9 10 11 cat > smokeping_prober.yaml <<EOF --- targets: - hosts: - 1.2.3.4 interval: 1s # Duration, Default 1s. network: ip # One of ip, ip4, ip6. Default: ip (automatic IPv4/IPv6) protocol: icmp # One of icmp, udp. Default: icmp (Requires privileged operation) size: 56 # Packet data size in bytes. Default 56 (Range: 24 - 65535) tos:

NFS Over RDMA
· ☕ 3 分钟
1. 前置条件 存储与使用存储的节点组成 RDMA 网络 RDMA 设备配置了 IP 地址 如果使用的是 Mellanox 网卡,在安装驱动时需要加上参数 -with-nfsrdma 1 ./mlnxofedinstall --with-nfsrdma 2. 服务端启动 安装依赖 1 apt install nfs-kernel-server rdma-core -y 加载内核模块 1 modprobe svcrdma 将端口加入 portlist 1 echo 'rdma 20049' | tee /proc/fs/nfsd/portlist 挂载目录 1 mkdir /data1/nfs 1 2 3 vim /etc/exports /data1/nfs *(rw,sync,no_root_squash,no_all_squash) 启动 NFS 服务 1 systemctl start nfs-server.service 检测挂载

kubectl logs 无法查看 Pod 日志报错 NotFound
· ☕ 1 分钟
1. 现象 能查看 Pod 的信息 1 2 3 4 kubectl -n my-testns get pod my-testpod NAME READY STATUS RESTARTS AGE my-testpod 1/1 Running 0 2d13h 不能查看 Pod 的日志 1 2 3 kubectl -n my-testns logs my-testpod -f Error from server (NotFound): the server could not find the requested resource ( pods/log my-testpod) 在 Pod 所在主机上可以通过 docker logs 查看容器日志。 测试 Kubelet 的健康状态 OK 1 curl -k https://x.x.x.x:10250/healthz 这里要使用主机的 IP 地址,kubectl logs 命名会直接