首页
导航
统计
留言
更多
壁纸
直播
关于
推荐
星的魔法
星的导航页
谷歌一下
镜像国内下载站
大模型国内下载站
docker镜像国内下载站
腾讯视频
Search
1
Ubuntu安装 kubeadm 部署k8s 1.30
391 阅读
2
kubeadm 部署k8s 1.30
280 阅读
3
rockylinux 9.3详细安装drbd
256 阅读
4
k8s 高可用部署+升级
231 阅读
5
rockylinux 9.3详细安装drbd+keepalived
187 阅读
默认分类
日记
linux
docker
k8s
ELK
Jenkins
Grafana
Harbor
Prometheus
Cepf
k8s安装
Gitlab
traefik
sonarqube
OpenTelemetry
MinIOn
Containerd进阶使用
ArgoCD
nexus
test
›
test2
test3
istio
golang
Git
Python
Web开发
HTML和CSS
JavaScript
对象模型
公司
zabbix
zookeeper
hadoop
登录
/
注册
Search
标签搜索
k8s
linux
docker
drbd+keepalivde
ansible
dcoker
webhook
星
累计撰写
158
篇文章
累计收到
1,008
条评论
首页
栏目
默认分类
日记
linux
docker
k8s
ELK
Jenkins
Grafana
Harbor
Prometheus
Cepf
k8s安装
Gitlab
traefik
sonarqube
OpenTelemetry
MinIOn
Containerd进阶使用
ArgoCD
nexus
test
test2
test3
istio
golang
Git
Python
Web开发
HTML和CSS
JavaScript
对象模型
公司
zabbix
zookeeper
hadoop
页面
导航
统计
留言
壁纸
直播
关于
推荐
星的魔法
星的导航页
谷歌一下
镜像国内下载站
大模型国内下载站
docker镜像国内下载站
腾讯视频
搜索到
156
篇与
的结果
2025-12-11
gin
Engine(路由器/入口) → HandlerFunc(处理函数) → Context(请求上下文)// 经典模版 r := gin.Default() r.GET("/ping", func(c *gin.Context) { c.JSON(200, gin.H{"msg": "pong"}) }) r.Run(":8080")所有 Gin 的东西基本都能从这里长出来: 想加中间件:r.Use(...) 想分组:g := r.Group("/api") 想绑定参数:c.Param / c.Query / c.ShouldBindJSON 想返回:c.JSON / c.String / c.Status建议你先只覆盖 80% 场景的 12 个: 路由/中间件 gin.Default() / gin.New() r.Use(mw...) r.GET/POST/... r.Group("/xx") 取数据 c.Param("id")(路径参数) c.Query("k")(query 参数) c.GetHeader("Authorization") c.ShouldBindJSON(&obj)(JSON body) 回数据 c.JSON(code, obj) c.String(code, "text") c.Status(code) c.AbortWithStatusJSON(code, obj)(中断链路)package main import ( "github.com/gin-gonic/gin" "net/http" ) func main() { // 创建一个默认的路由引擎 r := gin.Default() // 注册一个GET 路由: 访问/ping 返回JSON r.GET("/ping", func(c *gin.Context) { //c.JSON(200, map[string]interface{}{ // "message": "pong", //}) // 上面的写法等同于下面的 c.JSON(http.StatusOK, gin.H{ "message": "pong", }) }) // /hello?name=Tom r.GET("/hello", func(c *gin.Context) { // ? 后面的叫 查询参数(Query String): //name 是参数名 //Tom 是参数值 //如果是 /hello?name=Tom&age=18: //name → Tom //age → 18 //c.Query("name") 做了什么? //c.Query("name") 就是从 URL 的 query 里拿值: name := c.Query("name") // 获取 query参数 在URL后面加上/hello?name=Tom 返回的结果就是 hello, Tom! 如果只访问/hello 就返回下面默认的 hello,world! age := c.Query("age") if name == "" { name = "world" } if age == "" { age = "18" } c.String(http.StatusOK, "hello, %s , age %s!", name, age) }) r.Run() }
2025年12月11日
47 阅读
0 评论
0 点赞
2025-12-11
velero
velero schedule getvelero get backup
2025年12月11日
41 阅读
0 评论
0 点赞
2025-12-05
traefik-gatway
测试yamlroot@k8s-01:~# cat traefik-gateway-nginx.yaml --- apiVersion: gateway.networking.k8s.io/v1 kind: GatewayClass metadata: name: traefik spec: controllerName: traefik.io/gateway-controller --- apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: traefik-gw namespace: default spec: gatewayClassName: traefik listeners: - name: http protocol: HTTP port: 8000 # ? 这里从 80 改成 8000,匹配 Traefik 的 entryPoints.web allowedRoutes: namespaces: from: Same --- apiVersion: apps/v1 kind: Deployment metadata: name: nginx namespace: default spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:latest ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx namespace: default spec: selector: app: nginx ports: - port: 80 targetPort: 80 --- apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: nginx namespace: default spec: parentRefs: - name: traefik-gw namespace: default sectionName: http # ? 明确绑定到上面 listener 名称 http(可选,但更清晰) hostnames: - "nginx.example.com" rules: - matches: - path: type: PathPrefix value: / backendRefs: - name: nginx port: 80 traefik 启用 Gateway API Providerroot@k8s-01:/woke/traefik# ls Changelog.md Chart.yaml crds EXAMPLES.md Guidelines.md LICENSE README.md templates traefik-values.yaml VALUES.md values.schema.json values.yaml root@k8s-01:/woke/traefik# cat traefik-values.yaml # 1. Dashboard / API 配置 api: dashboard: true # ⚠️ 这里是顶层的 ingressRoute,不在 api 下面 ingressRoute: dashboard: enabled: false # 关键:改成 web,让它走 80 端口(NodePort 30080) entryPoints: - web matchRule: PathPrefix(`/dashboard`) || PathPrefix(`/api`) annotations: {} labels: {} middlewares: [] tls: {} # 2. 入口点配置(保持你原来的) ports: traefik: port: 8080 expose: default: false exposedPort: 8080 protocol: TCP web: port: 8000 expose: default: true exposedPort: 80 protocol: TCP nodePort: 30080 websecure: port: 8443 hostPort: containerPort: expose: default: true exposedPort: 443 protocol: TCP nodePort: 30443 # 3. Service 配置:NodePort service: enabled: true type: NodePort single: true spec: externalTrafficPolicy: Cluster annotations: {} labels: {} # 4. RBAC rbac: enabled: true # 5. metrics(你这里开 prometheus 也没问题) metrics: prometheus: enabled: true logs: general: level: INFO access: enabled: true format: common # 6. 启用 Gateway API Provider providers: kubernetesGateway: enabled: true
2025年12月05日
26 阅读
0 评论
0 点赞
2025-11-25
函数
一、闭包函数func startWorker(id int) { go func() { for { fmt.Printf("Worker %d is woerkding\n", id) time.Sleep(time.Second) // 默认一秒 break } }() } //上面go代表着异步执行 //()等于马上执行一次 func NewCounter() func() int { count := 0 return func() int { count++ return count } } // 上面函数需要外部调用执行 里面会保留结果 N := NewCounter() 后面每fmt.Println(N())一次就结果就会变 每次打印就会自动执行一遍
2025年11月25日
39 阅读
0 评论
0 点赞
2025-11-22
jenkins cicd架构
暂无简介
2025年11月22日
39 阅读
0 评论
0 点赞
1
...
4
5
6
...
32