上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 69 下一页

2024年9月15日

k8s部署单机redis pod

摘要: kind: ConfigMap apiVersion: v1 metadata: name: redis namespace: default labels: app: redis data: redis.conf: |- port 6379 bind 0.0.0.0 dir /data appen 阅读全文

posted @ 2024-09-15 11:14 王景迁 阅读(42) 评论(0) 推荐(0)

2024年9月8日

ginkgo编写测试用例

摘要: 安装依赖 go get github.com/onsi/ginkgo/v2/ginkgo go install github.com/onsi/ginkgo/v2/ginkgo go get github.com/onsi/gomega 运行用例 mkdir test cd test ginkgo 阅读全文

posted @ 2024-09-08 16:24 王景迁 阅读(159) 评论(0) 推荐(0)

MySQL 函数查询返回NULL

摘要: create table user(id bigint primary key auto_increment, age int); gorm使用函数查询时,通过IFNULL来确保查询不到记录时有默认值。 max函数 select max(age) from user; select IFNULL(m 阅读全文

posted @ 2024-09-08 15:31 王景迁 阅读(24) 评论(0) 推荐(0)

kube-controller-manager如何处理多种cr变更

摘要: k8s v1.19.0以deployment controller为例pkg/controller/deployment/deployment_controller.gorun函数处理enqueueDeployment函数写入队列的key namespace/name,与pkg/controller 阅读全文

posted @ 2024-09-08 12:13 王景迁 阅读(22) 评论(0) 推荐(0)

2024年9月7日

Etcd集群备份失败问题

摘要: 问题现象 k8s中etcdctl备份etcd时第2步卡住。 export ETCDCTL_API=3 etcdctl --endpoints 172.18.0.2:2379 snapshot save snapshot.db 问题分析 k8s中执行etcdctl命令时没有指定证书文件路径。 解决问题 阅读全文

posted @ 2024-09-07 18:42 王景迁 阅读(113) 评论(0) 推荐(0)

Etcd集群备份恢复

摘要: 安装Etcd集群 docker pull quay.io/coreos/etcd:v3.3.1 docker run -d --name etcd1 quay.io/coreos/etcd:v3.3.1 etcd -name etcd1 -advertise-client-urls http://1 阅读全文

posted @ 2024-09-07 17:48 王景迁 阅读(26) 评论(0) 推荐(0)

curl命令更新k8s cr status

摘要: 因为status是cr的subresource,所以不支持使用kubectl直接更新cr status,由controller来更新status。在KubeBuilder框架中,使用xxx.Status().Update(xxx)方式来更新status。在ClientSet中,通过UpdateSta 阅读全文

posted @ 2024-09-07 15:29 王景迁 阅读(198) 评论(0) 推荐(0)

go 使用grpc和grpcurl

摘要: 安装依赖和工具 # ubuntu安装protobuf apt install libprotobuf-dev protobuf-compiler protoc-gen-go protoc-gen-go-grpc -y # 查看protobuf版本 protoc --version # 安装grpcu 阅读全文

posted @ 2024-09-07 10:12 王景迁 阅读(233) 评论(0) 推荐(0)

2024年9月3日

multus实现自定义网卡名字

摘要: 安装环境 cat <<EOF | kind create cluster --name test --config - kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 networking: kubeProxyMode: iptables disab 阅读全文

posted @ 2024-09-03 09:18 王景迁 阅读(56) 评论(0) 推荐(0)

2024年8月28日

go 结构体列表比较是否相等

摘要: 使用reflect的DeepEqual方法,列表匹配时按顺序逐个比较。 场景1:结构体列表按顺序匹配(直接比较) package main import ( "fmt" "reflect" ) type Student struct { Age int Score int } func main() 阅读全文

posted @ 2024-08-28 21:15 王景迁 阅读(29) 评论(0) 推荐(0)

上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 69 下一页

导航