摘要:strace用于跟踪进程运行时系统调用和接收的信号,支持跟踪要启动和已运行的进程。 参数 含义 -T 显示系统调用消耗时间 -tt 显示毫秒级别时间 -p 指定跟踪的进程 -v 输出环境变量等上下文内容 例如,查看进程对应的线程系统调用。 strace -fp [pid] -T -tt 2>&1 p
阅读全文
摘要:k8s v1.19.0 staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go List方法(client-go Lister的List方法在找不到时不会报错not found) staging/src/k8s.io/apiserver/p
阅读全文
摘要:informer cache默认通过namespace/name作为key把对象保存到map中。条件查询时一般通过labels.Selector来过滤,但这需要遍历所有元素,informer cache可以类似于MySQL那样建立索引,来提高查询速度。 // map根据指定的key来给对象分类 //
阅读全文
摘要:// main_call_other_file_const_define.go package main const ( Num = 10 ) // main_call_other_file_const.go package main import "fmt" func main() { fmt.P
阅读全文
摘要:k8s v1.19.0 默认情况下,k8s不支持多个cni插件混用。在/etc/cni/net.d存在多个cni配置时,dockershim只会加载按字母顺序排序的第1个插件。 cmd/kubelet/app/options/container_runtime.goNewContainerRunti
阅读全文
摘要:# 安装gcc和g++ yum install gcc yum install gcc-c++.x86_64 // a.cpp #include <iostream> #include <unistd.h> using namespace std; class Test { public: void
阅读全文
摘要:func addListWatchCfgAndClient() { cfg, err := clientcmd.BuildConfigFromFlags("", "/root/.kube/config") if err != nil { klog.Fatalf("Error building kub
阅读全文
摘要:k8s v1.19.0 场景1:同步时连不上kube-apiserver会一直阻塞 WaitForCacheSync一直阻塞,直到成功或者控制器停止。 W0115 13:01:55.329881 18339 reflector.go:535] pkg/mod/k8s.io/client-go@v0.
阅读全文
摘要:问题1:go: updates to go.mod needed; to update it: go mod tidy方法:go clean -modcache && go mod tidy 问题2:go: updates to go.mod needed, disabled by -mod=ven
阅读全文
摘要:单节点k8s集群 v1.19.0 服务创建的https连接数量 client-go用于访问kube-apiserver,可以list/watch k8s资源。 组件名称 访问kube-apiserver方式 单个实例的https连接数 kube-scheduler 本机ip 2 kube-contr
阅读全文
摘要:package main import ( "fmt" "time" ) func test() { fmt.Println("") } func main() { time.Sleep(1000 * time.Second) } go build -gcflags=all="-N -l" -o t
阅读全文
摘要:安装Ubuntu Server 23.10 下载Ubuntu https://ubuntu.com/download/server mirror address填写为 http://mirrors.aliyun.com/ubuntu/ 安装Nettrace 下载nettrace rpm包 https
阅读全文
摘要:#include <stdio.h> struct s { int a; int b; }; int main() { struct s s1; // (struct s*)0表示0x0作为struct s首地址 // &((struct s*)0)->a代表a地址 // 因为struct s首地址
阅读全文
摘要:当网卡IP地址是32位掩码时,不管是同网段,还是跨网段,添加带有下一跳的路由时报错网络不可达,因为32位掩码意味着不存在链路层路由。 onlink参数作用是强制说明网关是在链路层上,可以把路由加上。
阅读全文
摘要:go.mod module lumberjack go 1.19 require ( gopkg.in/natefinch/lumberjack.v2 v2.2.1 k8s.io/klog/v2 v2.100.1 ) require github.com/go-logr/logr v1.2.0 //
阅读全文
摘要:src/inetaddr.c定义静态二维数组inet_addr_tab,值是双向链表,用于解决dpip ip哈希冲突。 include/netif.h核数最多是128 src/inetaddr.cinet_addr_init函数初始化空的双向链表 include/list.hINIT_LIST_HE
阅读全文
摘要:默认Linux自带了logrotate和crontabs。 配置logrotate日志压缩 设置定时压缩时间 # 每小时第10分钟执行一次压缩 vim /etc/crontab 追加 10 * * * * /usr/sbin/logrotate /etc/logrotate.d/test_logro
阅读全文
摘要:k8s v1.19.0 pkg\kubeapiserver\options\serving.goNewInsecureServingOptions函数 启动参数insecure-port设为0,不再开启非安全端口。staging\src\k8s.io\apiserver\pkg\server\opt
阅读全文